In this section we will learn about commenting in Java.
We will learn following things:
a) Identifiers in Java.
b) Object types in Java.
c) Code commenting in Java
d) Integer types in Java
e) Keywords in Java.
Following table shows all these things with relevant description.
Comments// Everything to the end of the line is ignored.
/* Everything (possibly many lines)
is ignored until a */
/** Used for automatic HTML documentation generation
by the javadoc program. */
TypesTypes are divided into two categories. There are 8 primitive types: boolean (true and false); char (Unicode characters); byte, short, int, and long (integers); float and double (floating point). Object types are created whenever a class is defined.Integer TypesThe integer types byte, short, int, and long are stored as two's complement, signed binary integers. char, which is technically also an integer type, is stored as an unsigned binary number. Expressions are computed as ints, so a cast is needed to store in a smaller type.
Floating-point TypesThe floating-point types, float and double, are stored in IEEE-754 format. Calculations may produce NaN (Not a Number) or +/- infinity. Calculations are done as doubles, so a cast is needed to store in a float.
char Typechar type is a Unicode character stored as an unsigned number in two bytes (range 0..65,535 or '\u0000'..'\uFFFF'). char is an integer type.Literals
boolean Typeboolean is used to store the values true or false. The storage is unspecified.Operators: logical, ==, !=, assignment. |
Identifiers
Keywords[types]
boolean byte char double float int short true false
[flow]
if else while for do continue
switch case break default
assert try catch
finally throw return
[OOP]
class extends implements instanceof interface new null super this
[declarations]
final import native package private protected public static throws
transient volatile void
[other]
strictfp synchronized goto const
VariablesVariables may be local, instance (field), or static (class) variables. Formal parameters are local variables that are assigned values when the method is called.
|