Skip to content

Commit fc2d2a8

Browse files
Literals
1 parent d47e0a7 commit fc2d2a8

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

4.Literals/README.md

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Java Tutorial: Literals in Java
2+
3+
### Literals
4+
- A constant value that can be assigned to the variable is called a literal.
5+
- 101 – Integer literal
6+
- 10.1f – float literal
7+
- 10.1 – double literal (default type for decimals)
8+
- ‘A’ – character literal
9+
- true – Boolean literal
10+
- “Harry” – String literal
11+
12+
### Keywords
13+
- Words that are reserved and used by the Java compiler. They cannot be used as an Identifier.
14+
- {You can visit docs.oracle.com for a comprehensive list}
15+
16+
### Code as Described in the Video
17+
18+
```
19+
package com.company;
20+
21+
public class CWH_04_literals {
22+
public static void main(String[] args) {
23+
byte age = 34;
24+
int age2 = 56;
25+
short age3 = 87;
26+
long ageDino = 5666666666666L;
27+
char ch = 'A';
28+
float f1 = 5.6f;
29+
double d1 = 4.66;
30+
boolean a = true;
31+
32+
System.out.print(age);
33+
34+
String str = "Harry";
35+
36+
System.out.println(str);
37+
}
38+
}
39+
```
40+
41+
### Handwritten Notes: [Click To Download](https://api.codewithharry.com/media/videoSeriesFiles/courseFiles/java-tutorials-for-beginners-4/JavaChapter1.pdf)
42+
43+
### Ultimate Java Cheatsheet: [Click To Download](https://api.codewithharry.com/media/videoSeriesFiles/courseFiles/java-tutorials-for-beginners-4/UltimateJavaCheatSheet.pdf)

0 commit comments

Comments
 (0)