Beginning Java: Data types, Variables, Arrays And Data Types in Java
Java is a simple, object oriented, high performance secure language. because java not use a pointers.
*data types in java is approx same as c,c++ language.
Data types in Java are classified into two types:
- 1.Primitive—which include Integer, Character, Boolean, and Floating Point.
- 2.Non-primitive—which include Classes, Interfaces, and Arrays.
1.Primitive
primitive data type are pre-define data types. There are following four differen types of data types.
1. Integer
Integer types can hold whole numbers such as 1,2,3,5895 and −96. The size of the values that can be stored depends on the data type(integer type) that we choose.
there are four sub types
default values :\u00Type | Size | |
---|---|---|
byte | 1 byte | |
short | 2 bytes | |
int | 4 bytes | |
long | 8 bytes |
2 Character
It stores character constants in the memory. It assumes a size of 2 bytes, but basically it can hold only a single character because char stores unicode character sets. It has a minimum value of 0 and a maximum value of 65,535 inclusive.
3.Floating Point
Floating point data types are used to represent numbers with a fractional part. Single precision floating point numbers occupy 4 bytes and Double precision floating point numbers occupy 8 bytes.
default values :0.0f
There are two subtypes:
default values :0.0f
There are two subtypes:
Type | Size | |
---|---|---|
float | 4 bytes | |
double | 8 bytes(default values :\u00) |
4. Boolean
Boolean data types are used to store values with two states: true or false.
default values :0.1
Non-primitive data type are user define data types. There are following three differen types of data types.
Non primitive data types are called reference types in Java and they refer to an object. They are created by the programmer and are not defined by Java like primitives are. A reference type references a memory location where the data is stored rather than directly containing a value.
they are three types
1. Array
2. class
3.Interface
very use full artical
ReplyDeleteHair Transplant in Kurukshetra
ReplyDeletePRP Treatment in Delhi
Hair Transplant in Ghaziabad
Thank you so much for relevant blog!
Best Meso Therapy Treatment in Delhi