Skip to content

Commit 70dee26

Browse files
Variables & Data Types
1 parent 1b28c9a commit 70dee26

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

3.Variables_and_data_types/README.md

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Java Tutorial: Variables and Data Types in Java Programming
2+
- Just like we have some rules that we follow to speak English (the grammar), we have some rules to follow while writing a Java program. This set of these rules is called syntax. It’s like Vocabulary and Grammar of Java.
3+
4+
### Variables
5+
- A variable is a container that stores a value.
6+
- This value can be changed during the execution of the program.
7+
- Example: int number = 8; (Here, int is a data type, the number is the variable name, and 8 is the value it contains/stores).
8+
9+
### Rules for declaring a variable name
10+
- We can choose a name while declaring a Java variable if the following rules are followed:
11+
- Must not begin with a digit. (E.g., 1arry is an invalid variable)
12+
- Name is case sensitive. (Harry and harry are different)
13+
- Should not be a keyword (like Void).
14+
- White space is not allowed. (int Code With Harry is invalid)
15+
- Can contain alphabets, $character, _character, and digits if the other conditions are met.
16+
17+
### Data Types
18+
Data types in Java fall under the following categories
19+
- Primitive Data Types (Intrinsic)
20+
- Non-Primitive Data Types (Derived)
21+
22+
### Primitive Data Types
23+
- Java is statically typed, i.e., variables must be declared before use. Java supports 8 primitive data types:
24+
25+
![image](https://user-images.githubusercontent.com/70385488/150118247-b3a99c81-3e86-49b4-b937-980ba0c8dd7c.png)
26+
27+
### How to choose data types for our variables
28+
- In order to choose the data type, we first need to find the type of data we want to store. After that, we need to analyze the min & max value we might use.
29+
30+
<img src="https://api.codewithharry.com/media/videoSeriesFiles/courseFiles/java-tutorials-for-beginners-3/base64.png" alt="">
31+
32+
### Handwritten Notes: [Click To Download](https://api.codewithharry.com/media/videoSeriesFiles/courseFiles/java-tutorials-for-beginners-3/JavaChapter1.pdf)
33+
34+
### Ultimate Java Cheatsheet: [Click To Download](https://api.codewithharry.com/media/videoSeriesFiles/courseFiles/java-tutorials-for-beginners-3/UltimateJavaCheatSheet.pdf)

0 commit comments

Comments
 (0)