[go: up one dir, main page]

0% found this document useful (0 votes)
27 views2 pages

Class 3

Uploaded by

ksnsatish
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views2 pages

Class 3

Uploaded by

ksnsatish
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

Print Statements

Print statements in Java are used to print the program output to the console. 

The below are the two types of print statements in Java:

Demonstrate print statements


Demonstrate println statements
Demonstrate printing a number and text

Comments

Comments provided in a Java program won't be executed and are generally used to explain the underlined code.

The below are the two types of comments in Java:

Demonstrate single line comments


Syntax: // Sample Comment Text
Demonstrate multi line comments
Syntax: /* Sample Comment Text */

Variables, Data Types, Operators and Literals

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

Variable is a name provided to a reserved memory location.

Refer more details here


There are two types of 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. 

You might also like