Tải bản đầy đủ (.pptx) (48 trang)

Intro to advanced programming (lập TRÌNH NÂNG CAO SLIDE)

Bạn đang xem bản rút gọn của tài liệu. Xem và tải ngay bản đầy đủ của tài liệu tại đây (520.56 KB, 48 trang )

ADVANCED PROGRAMMING
(LTNC)


Course Topics – Java Basics









Declarations and Access Control
Data Types
Varialable
Assignments
Operators
Object Orientation
Flow Control, Exceptions
String

Khoa CNTT – ĐH Nông Lâm TP. HCM 01/2016

2/48


Course Topics – Java Basics









Class defination
Access modifiers
Inheritance
Overriding / Overloading
Object reference
Constructor and instantiation
Class and Object varialables

Khoa CNTT – ĐH Nông Lâm TP. HCM 01/2016

3/48


Course Topics – GUI (SWING)









Swing overview

Swing by examples
Swing components
Layout Management
Event Handling
Performing custom painting
More Swing Features and Concepts
How to use the Swing components

Khoa CNTT – ĐH Nông Lâm TP. HCM 01/2016

4/48


Grading





Attendance: 15%
Midterm exam: 35% (Lab)
Final exam: 50% (Lab)

Khoa CNTT – ĐH Nông Lâm TP. HCM 01/2016

5/48


Bibliography
1. Core JAVA, Volume I, Cay S. Horstmann, Gary

Cornell, Sun MicroSystem Press, USA 2008.
2. Core JAVA, Volume II, Cay S. Horstmann,
Gary Cornell, Sun MicroSystem Press, USA
2008.

Khoa CNTT – ĐH Nông Lâm TP. HCM 01/2016

6/48


Computer Program

Set of instructions written
in a programming
language that tells the
computer what to do

Khoa CNTT – ĐH Nông Lâm TP. HCM 01/2016

7/48


The Programming Process

Defining the problem
Planning the solution
Coding the program
Testing the program
Documenting the program
Khoa CNTT – ĐH Nông Lâm TP. HCM 01/2016


8/48


The Programming Process:
Defining the Problem




What is the input
What output do you expect
How do you get from the input to the output

Coding the Program




Translate algorithm into a formal programming
language
Within syntax of the language



Text editor
Programming environment: Interactive
Development Environment (IDE)
Khoa CNTT – ĐH Nông Lâm TP. HCM 01/2016


9/48


Languages
1. Machine code or machine languages
 A sequence of 0’s and 1’s giving machine
specific instructions. Example: 00011001
 Displayed as hexadecimal






Only language the computer understands
All other programming languages are translated
to machine language
Computer dependent
Khoa CNTT – ĐH Nông Lâm TP. HCM 01/2016

10/48


Languages
2. Assembly language
 Using meaningful symbols to represent
machine code. Example: add hl,de
 Names for memory locations
 Computer dependent
 “Assembler” translates from Assembly to

machine language



Assembler: Assembly code  machine code
Disassembler: machine code  assembly
code
Khoa CNTT – ĐH Nông Lâm TP. HCM 01/2016

11/48


Languages
3. High-level languages
 Similar to everyday English and use
mathematical notations (processed by
compilers or interpreters)
 Example of a C statement: a = a + 8;
High-level Languages and Their Inventors








FORTRAN John W. Backus, 1954
BASIC
George Kemeny and Tom Kurtz, 1964

Pascal
Nicolas Wirth
C
Dennis M. Ritchie
C++
Bjarne Stroustrup
Java
James Gosling
C#
Anders
Khoa
CNTT – Hejlsberg
ĐH Nông Lâm TP. HCM 01/2016
12/48


Popularity

Khoa CNTT – ĐH Nông Lâm TP. HCM 01/2016

13/48


Programming classification


Programming = Programming Language +
Algorithms + (Database)

Assembly


Java
C / C++

C#
Pascal

Language
Level
Khoa CNTT – ĐH Nông Lâm TP.
HCM 01/2016

14/48


ABOUT THE JAVA TECHNOLOGY




Java technology is both a programming language and a
platform
The Java programming language is a high-level
language that can be characterized by all of the
following buzzwords:












Simple
Architecture neutral
Object oriented
Portable
Distributed
High performance
Multithreaded
Robust
Dynamic
Secure
Khoa CNTT – ĐH Nông Lâm TP. HCM 01/2016

15/48


ABOUT THE JAVA TECHNOLOGY


In the Java programming language, all source code
is first written in plain text files ending with the
.java extension. Those source files are then
compiled into .class files by the Java compiler
(javac). A .class file does not contain code that is
native to your processor; it instead contains

bytecodes-- the machine language of the Java
Virtual Machine. The Java launcher tool (java) then
runs your application with an instance of the Java
Virtual Machine.

Khoa CNTT – ĐH Nông Lâm TP. HCM 01/2016

16/48


ABOUT THE JAVA TECHNOLOGY

Khoa CNTT – ĐH Nông Lâm TP. HCM 01/2016

17/48


JVM – Java Virtual Machines







Virtual machines depend on specific platforms
(hardware, OS)
Provide Java programs with (platform independent)
run-time environments
Ensure system security

Normally provided as software




JRE - Java Runtime Environment

Java platform: JVM + APIs

18

Khoa CNTT – ĐH Nông Lâm TP. HCM 01/2016

18/48


The Java Runtime Environment


The Java application environment performs as
follows:

19

Khoa CNTT – ĐH Nông Lâm TP. HCM 01/2016

19/48


JVM™ Tasks



The JVM performs three main tasks:


Loads code – Performed by the class loader.






Verifies code – Performed by the bytecode verifier.









Loads all classes necessary for the execution of a
program.
Avoids execution of the program whose bytecode has
been changed illegally.
The code adheres to the JVM specification.
The code does not violate system integrity.
The code causes no operand stack overflows or
underflows.

The parameter types for all operational code are correct.
No illegal data conversions have occurred.

Executes code – Performed by the runtime interpreter.
20

Khoa CNTT – ĐH Nông Lâm TP. HCM 01/2016

20/48


Environment

21

Khoa CNTT – ĐH Nông Lâm TP. HCM 01/2016

21/48


JDK – Java Development Kit





Free development and run-time environment
provided by Sun Microsystems ()
Most widely used Java software development kit
Main components:











javac compiler, converts source code into Java
bytecode
java interpreter and application loader
appletviewer interpreter, run and debug Java applets
without a web browser
javadoc documentation generator, automatically
generates documentation from source code comments
jdb debugger
javap class file disassembler
22

Khoa CNTT – ĐH Nông Lâm TP. HCM 01/2016

22/48


Types of Java applications


Desktop application – Java SE (Java Standard

Edition)






Server application – Java EE (Java Enterprise
Edition)






Java Application: normal Java application running
on desktops; console or GUI
Java Applet: embedded application running
within Web browsers

JSP và Servlet, JSF, EJB

Mobile (embedded) application – Java ME (Java
Micro Edition)
Java Card
23

Khoa CNTT – ĐH Nông Lâm TP. HCM 01/2016

23/48



Java Desktop Applications





Complete application programs
Console or GUI
Launched by java command

24

Khoa CNTT – ĐH Nông Lâm TP. HCM 01/2016

24/48


A Sample Java program
TestGreeting.java
Declare new class

same name with class

commented line

// This is a simple program

main method from

where the program
begins its execution

public class TestGreeting {
public static void main(String[] args) {
System.out.println("Hello, world");
}
}
object

message

displays the string Hello,
world on the screen
25

Khoa CNTT – ĐH Nông Lâm TP. HCM 01/2016

25/48


×