How to declare primitive as well as non-primitive data types in JAVA?
Answers
Answered by
1
Primitive Versus Non-Primitive
The primitive data types include byte, int, long, short, float, double, and char. ...Non-primitive, or reference data types, are the more sophisticated members of the data type family. ...Reference types can be a class, interface, or array variable.
The primitive data types include byte, int, long, short, float, double, and char. ...Non-primitive, or reference data types, are the more sophisticated members of the data type family. ...Reference types can be a class, interface, or array variable.
Answered by
1
Primitive data types are byte,short, int, long, float, double, char and boolean. They can be declared using a literal.
Eg: int x=7;
double p=7.8;
Non primitive or Reference data types are class, interface and arrays.
They can be initialised only by using a new keyword.
Eg: int a[]=new int[5];
Eg: int x=7;
double p=7.8;
Non primitive or Reference data types are class, interface and arrays.
They can be initialised only by using a new keyword.
Eg: int a[]=new int[5];
Similar questions