■ The seven characters which denote floating point literals are: . (dot), d, D, e, E, f, F with e as in 400e+20 meaning 400 raised to 20th power. Caps or small is OK for these letters. i.e.
long x = 20L; works.
long x = 20l; works.
■ The six characters which denote automatic casting are d and D for double, f and F for float, and l and L for long.
There is no S for short, no B for byte, no I for int, and no C for char.
■ A leading zero means it’s Octal coming in. Otherwise the assigned value is interpreted as decimal. i.e.
long x = 010; yields 8.
char x = '\077'; shows that octal will work with or without a backslash.
■ A leading zero and an x means it’s hex coming in. i.e.
long x = 0xffff;
long x = 0Xffff; both work
■ You cannot insert blanks to separate the four hex digit characters. i.e.
long x = 0Xff ff; will not compile.
■ Note that hex digits can also be capitals. i.e. ff is the same as FF
■ You do not need orderly pairs of hex digits. i.e.
float f = 0x7; compiles.
float f = 0x777; compiles.
■ Primitive chars can optionally be assigned using int equivalents, without the usual single quotes. i.e.
char A = 65; This is the letter A.
■ Unlike with hex, for a char you must show all 4 hex digits. i.e.
char x = ‘\uff’; will not compile - not enough digits.
char x = 0Xff; compiles.
■ Note that the print(...) method attempts to print chars as the Unicode character they represent.
So trying to print anything with a value over char 127 prints as a question mark.