/* Print a greeting message in the console window */ public class Hello { public static void main(String[] args) { // The next statement prints a message to the console window System.out.print("Hello World!"); } } |
We will use this simple program to illustrate some concepts
(If your program gets messy, it's very hard to understand what the program is doing)
public class CLASSNAME { PROGRAM UNITS } |
Notes:
|
|
There are some rules in Java that you must follow to form the identifer name
|
age Age (is different from age) greaterCommonDivisor R2D2 radius_of_the_circle |
3cpo (cannot start with a digit) radius-of-the-circle (cannot have minus sign in an identifier) |