Datatypes:
Datatypes are used to store the date. Java has two types of datatypes. They are,
1. Primitive datatype
2. Non-primitive datatype
Primitive Datatype:
Primitive datatypes are fixed. They are, Numeric and Non-Numeric.
Numeric type:
1.Byte: 1-byte signed two's complement integer.
2.Short: 2-bytes signed two's complement integer.
3.int: 4-bytes signed two's complement integer. This is the default integer type.
4.long: 8-bytes signed two's complement integer. Used for very large integer values.
5.float: 4-bytes floating-point number. Used for decimal values.
6.double: 8-bytes floating-point number.
Non-Numeric type:
1.char: 2-bytes Unicode character. Used to store single characters.
2.boolean: Represents a logical value, only be true or false.
Non-Primitive Datatypes:
Non-Primitive datatypes are non fixed. They are,
1.strings
2.objects
3.arrays
Variables:
Datatypes are used in variables. There are two types of variables. They are,
1.Inside the method
2.Outside the method
How to declare, initialize and Reassign a variable?
int number; (variable declaration)
number=50; (Initialize)
number=60; (Reassign)