What are statements in java

what are statements in java


Each type in the Java programming language has literals. the way to specify unnamed constant values for the type. For example, the boolean type has two literals, true and false. Object reference types have only one literal, null.

Integer literals come in three forms: decimal, hexadecimal, and octal. The way an integer literal begins indicates the base of the number. If the number begins with a 0x or 0X. it is hexadecimal (base 16). Some examples are: 0x5. 0X00FF. and 0xcafebabe. If the number begins with only a zero, it is an octal (base 8). Some examples are: 035. 0777. 0321. If the number begins with a non-zero digit, it is decimal: 31. 255. 20. If an integer literal ends in an L or l. it is a long. otherwise it is an int. Some examples of long integer literals are: 0XCAFEBABEL. 035L. 31L. If an int literal is assigned to a variable of type short or byte. the literal is treated as if it were a short or byte type so long as the literal value is within the valid

range for that type.

Floating point literals are made up of decimal digits, optionally containing a decimal point, and optionally followed by an E or e and an exponent. Some examples of floating point literals are: 3.14159. 314159e1. 34.26E23. If a floating point literal ends in a F or f. it is a float. otherwise it is a double. Optionally, a double floating point literal can end in D or d. Some examples of float literals are: 3.14159F and 3e5f. The same values expressed as doubles could look like this: 3.14159 and 3e5D.

Character literals can be any Unicode character between single quotes, such as 'A'. In addition to providing an explicit character between the single quotes, you can provide an octal or hex number preceded by a backslash. The octal number must be between '\0' and '\377'. The hex number must have four digits. It is preceded with either a \u or \uu. as in: '\u0073' and '\uu039d'. There are also several character literals represented by special escape sequences, shown in Table 3-1.

Table 3-1. Special Character Literal Escape Sequences

Source: www.artima.com

Category: Forex

Similar articles: