PIC20A Lecture 1

In this lecture, we will discuss
  1. what is Java?
  2. how to compile and execute a java program
  3. hello world program

What is java?

Before we discuss what is java, we will say a few words on what Java is not in this class: Java is a programming langauge developed by Sun Microsystems
Read the textbook p2-p8 or In particular,

What is so special about Java?

How to create a Java program?

There are 3 main steps Please read textbook p8 - 12 Your First Cup of Java. Ignore the parts related to Applet.

Additional information

Text Editor
Here are some other text editors you can use to write your source file, example DOS Command
Here are 2 useful DOS commands

Hello World Program

Please read Textbook p32-36 or A Closer Look at HelloWorld and all the links in the webpage.
/** 
 * The HelloWorldApp class implements an application that
 * simply displays "Hello World!" to the standard output.
 */
class HelloWorldApp {
    public static void main(String[] args) {
        System.out.println("Hello World!"); //Display the string.
    }
}
You should know

Additional information

Try this program
class HelloWorldApp2 {
    public static void main(String[] args) {
        System.out.println("Hello " + args[0]); 
    }
}
The output of the program is
Hello Charles (or Hello Amy)

Write Once, Run Everywhere!