Data Types in Java
Data Types in Java
-
Java is rich in its data type.
-
Data type tells the type of data, that you are going to store in memory.
-
It gives the information that which operations that may be performed on it.
1 . Primitive data types
2 . Non-primitive data types

Primitive Data Types
- The Java programming language supports eight primitive data types.
- A primitive type is predefined by the language and is named by a reserved keyword.
- Primitive values do not share state with other primitive values.
The eight primitive data types supported by the Java programming language are:
Data Type | Size | Default Value (for fields) |
---|---|---|
boolean | 1 bit | false |
char | 2 byte | '\u0000' |
byte | 1 byte | 0 |
short | 2 byte | 0 |
int | 4 byte | 0 |
long | 8 byte | 0L |
float | 4 byte | 0.0f |
double | 8 byte | 0.0d |

Tips :
There are only two values for boolean data type either true or false, and cannot replace it with 1 0r 0.
Default values are for fields, not for local variables.
The compiler never assigns a default value to an uninitialized local variable. make sure to assign it a value before you attempt to use it.
Accessing an uninitialized local variable will result in a compile-time error.
Default value for reference variable is null.
Next topic is Java-Identifiers
Training For College Campus
We offers college campus training for all streams like CS, IT, ECE, Mechanical, Civil etc. on different technologies
like
C, C++, Data Structure, Core Java, Advance Java, Struts Framework, Hibernate, Python, Android, Big-Data, Ebedded & Robotics etc.
Please mail your requirement at info@prowessapps.in
Projects For Students
Students can contact us for their projects on different technologies Core Java, Advance Java, Android etc.
Students can mail requirement at info@prowessapps.in