javac XXX.java. java XXX . main method. public static void main(String[] args) java ClassName . String[].
The return tpye is void. It is no different from other methods. args is a String array. You can use
args.length to access the length of args.args[0], args[1]... to access the elements in
the array args[i] (i.e.
i >= args.length ) an error will occur
during runtime. java ClassName string0 string1 .. String[] args = {string0, string1 , ... } is created args pass to main(String[] args) and the method body is
executedargs is a null . java ClassName "Charles Li". System.out.println(string) to print out a string
and then go to next line.System.out.print(String) to print out a string without
going to a new line at the end. System.out.println(....) can print out
int, float,... as well. public, class, void
....myName is different from
MyName. byte, short, int, long, float, double, char, boolean. long is more precise than int,
double is more precise than float etc etc. int a, b, c
double are
double a = 3.14, b = 3, c = 2.713e10, d = 34.665e5d;
float are very similar to
double. You have to add f at the end of the number.
float a = 3.14f, b= 34.665e5f;
float a = 3.14 causes an compiling error because
3.14 is a double by defalt long x = 58819394L; . int char represents a character. boolean a = true; boolean b = false;
if, else, while, do-while, for, switch .
ClassName[] arrayName arrayName = new
ClassName[size]. null.
int[] array1 = {1,2,3,4,5};
String[] array2 = {"this", "is" , "review" , "notes"}
array.length to get the size of the array.
String by
String s = "Hi"; + String
class. But you should understand the methods. Documentation will be
provided if I ask questions on this class. new. private, protected and public and their meaning. static variables and
non-static variables. this and super. final. BorderLayout, GridLayout, FlowLayout BorderLayout.NORTH, BorderLayout.SOUTH,... to
specific the direction. add(component) or add(component,
BorderLayout.CENTER) to add to the center. add(component, BorderLayout.NORTH) etc to add to the
north remove(int) to remove BorderLayout. getContentPane().add(...) to add components. or
getContentPane().setLayout(..) to set layout. setSize, pack,
setVisible, setLocation,
setBackground and all other methods I mentioned in the handout. ImageIcon and set the image
icon.