Basic Language Elements
1 Identifiers: In Java an indentifier is composed of a sequence of characters, where each character can be either a letter, a digit, a connecting punctuation(such as underscore_), or any currency symbol(such as $, ¥). However , the first character in an identifier cannot be a digit.
Examples of Legal Identifiers: ¥money,你好
Examples of Illegal Identifiers: 48money, all@hands, grand-sum
2 Keywords: ... assert, default, instanceof, final, finally, native, strictfp, synchronized, throw, throws, transient, volatile...
Reserved Literals in Java: null, true, false
Reserved keywords not currently in use: const, goto
3 Primitive Data Types:
boolean
char 8
Integer Types:
byte 8
short 16
int 32 default
long 64
Floating-point Types:
float 32
double 64 default
4 Lifetime fo Variables:
Instance variables: Instance variables exist as long as the object they belong exists.
Static variables: They are created when the class is loaded at runtime, adn exist as long as the class existes.
Local variables: After the excution of the method or block completes, local(non-final) variables are no longer accessible. Local variables need to be initilized.
5 The main method:
final public static void main(String[] args) throw Exception {} //It's OK!!
|