// Single line comment /* Multiple Lines Comment */ /** JavaDoc Comment */
JavaDoc should be avoided due to keep the code clean
- Class name identifier should start with capital letter e.g.
public class Welcome1
- Identifier can comprise of letter, number, underscore, and $. But $ should be avoided as it is usually used by compiler for special things.
- For multi-word class name, use
Java is case-sensitive language
public static void main(String args)
mainmethod must be all lower case letters
- All classes under
java.lange.g. System, String are automatically imported.
> javac Welcome1.java
- .class file (Java byte code) is generated and can be JIT-compiled and execued by JVM
> java Welcome1 Welcome to Java Programming!
Primitive Types vs. Reference Types
8 Primitive Types
- byte - 1-byte integer
- char - 1-byte unsigned integer
- short - 2-byte integer
- int - 4-byte (32 bit) integer
- long - 8-byte (64 bit) integer
- float - 4-byte decimal number
- double - 8-byte decimal number
- All types are initialized with 0 except boolean that is initialized as false.
- Java guarantees fixed size of each primitive types, not varying by system
- boolean is not a number in Java
- All non-primitive types, usually start with Capital leter
- Is an object so initialized as null
- Can contain instance variables and methods