6. Data Types in Java
6
Data types specify size and the type of values that can be stored in an identifier.
In java, data types are classified into two categories :
▰ Primitive Data type
▰ Non-Primitive Data type
Type of data that can be stored in this variable.
9. Non-Primitive(Reference) Data type
9
Non-Primitive Data Types are also called as Reference Data Types as the
address of the objects or Arrays is stored in a reference variable.
InterfacesClasses Arrays
10. Variables in Java
When we want to store any information, we store it in an address of
the computer.
Variable is a name of memory location.
10
11. Types of Variables in Java
11
Local Instance Static
There are three types of variables in Java:
public class FirstClass{
int data=50; //instance variable
static int m=100; //static variable
public static void main(Striang [] args){
int n=90; //local variable
}
}//end of class
12. Type Casting
Assigning a value of one type to a variable of another type is known
as Type Casting.
Example :
12
int x = 10;
byte y = (byte)x;
13. Type Casting in Java
13
In Java, type casting is classified into two types,
14. Java Operators
▰ Arithmetic operators
▰ Relation operators
▰ Logical operators
▰ Bitwise operators
▰ Assignment operators
▰ Conditional operators
▰ Misc operators
14
Java provides a rich set of operators environment. Java operators can be divided into following
categories: