Lecture02 Java Basics1
Lecture02 Java Basics1
What is java?
Based on C/C++
Widespread acceptance
Java Features
Simple/
Object oriented
Platform Independent
Portable
Secure
Multithreaded
Getting Started: (1)
(1) Create the source file:
open a text editor, type in the code which defines a class
(HelloWorldApp) and then save it in a file (HelloWorldApp.java)
file and class name are case sensitive and must be matched
exactly (except the .java part)
Example Code: HelloWorldApp.java
/**
* The HelloWorldApp class implements an application
* that displays "Hello World!" to the standard output
*/
public class HelloWorldApp {
public static void main(String[] args) {
// Display "Hello World!"
System.out.println("Hello World!");
}
}
Java is CASE SENSITIVE!
Getting Started: (2)
(2) Compile the program:
compile HelloWorldApp.java by using the following command:
javac HelloWorldApp.java