Compilation
- javac Prog_Name.java
- Output : Prog_Name.class (bytecode file)
Execution
- java Prog_Name
Structure
class Prog_Name
{
public static void main(String args[])
{
....
}
}
public : main() should be able to be called by the JVM i.e the code outside the class.
static : main() would have to be called by JVM before creating an instance of the class containing it.
Comments
Multiline : /* for multiple line comments */
Singleline : // single line comment
Documentation : /** used to produce an HTML file that documents your program */
Misc
- There are 50 keywords in JAVA.
- true,false,null are reserved apart from the 50 keywords.
- JAVA is a strongly typed language , meaning , variables have data types and type compatibility is checked before assigning the value of an expression to a variable.