Class 3
Class 3
Print statements in Java are used to print the program output to the console.
Comments
Comments provided in a Java program won't be executed and are generally used to explain the underlined code.
In order to store the data in Java programs, we need to use Variables, Data Types, operators and Literals.
Example: int a = 5;
Refer more details here
Demonstrate a program which stores the data into a variable and prints it
Variables
Local Variables
A variable which is declared inside the method is called local variable (Demonstrate here)
Instance Variables
A variable which is declared inside the class but outside the method is called Instance variable (Demonstrate
here)
We have to specify the static text before the instance variable as the method which is going to use this
variable is a static method
This concept will be explained in upcoming sessions.