Skip to content

Commit f71dbe4

Browse files
committed
Literals: Java Literals are syntactic representations of boolean, character, numeric, or string data.
Signed-off-by: Somesh diwan <[email protected]>
1 parent 9f23b5a commit f71dbe4

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Section5OperatorExpression/Txt and Images/literals.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ range of the target type. An integer literal can always be assigned to a long va
1414
literal, you will need to explicitly tell the compiler that the literal value is of type long. You do this by appending
1515
an upper- or lowercase L to the literal.
1616

17-
Beginning with JDK 7, you can also specify integer literals using binary. To do so, prefix the value with 0b or 0B.
17+
Beginning with JDK 7, you can also specify integer literals using binary.
18+
19+
To do so, prefix the value with 0b or 0B.
1820
For example, this specifies the decimal value 10 using a binary literal: int x = 0b1010;
1921

2022
int x = 123_456_789;
@@ -44,4 +46,4 @@ and easy to use.
4446

4547
The remainder a % b is defined such that (a / b) * b + a % b is always equal to a :
4648
System.out.println(-15 % 2); // -1
47-
System.out.println(15 % -2); // 1
49+
System.out.println(15 % -2); // 1

0 commit comments

Comments
 (0)