1.2.3.4.5.6.
Almost the same with C,so I wont't go into details.
One point is worthy to be mentioned,in java,& and | is legal,however,they are hardly used cuz they are inefficient for they execute every boolean expression,different from && that if the first one is false it will directly return false,|| goes similarily.
As for method,it is similar with function in C.
the form is
public static datatype name( ){
}
nothing or some formal parameters will go in the parentheses.
7.8.
Reload is an important concept in programming language.Legal reload means all methods share the same name,but things in their parentheses differ.
Cases below are all legal.(Let's assume the method name is add)
public static void add(int a,double b)
public static void add(int a,int b)
public static void add(double a,int b)
public static void add(doub;le a,double b)
Reload can avoid the trouble when naming the methods that almost do the same thing.