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.

In Java there are two types of data types:
     1 . Primitive data types
     2 . Non-primitive data types

prowessapps.in

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 TypeSizeDefault Value (for fields)
boolean1 bit false
char2 byte '\u0000'
byte1 byte 0
short2 byte 0
int4 byte 0
long8 byte 0L
float4 byte 0.0f
double8 byte 0.0d
prowessapps.in

Tips :

  1. There are only two values for boolean data type either true or false, and cannot replace it with 1 0r 0.

  2. Default values are for fields, not for local variables.

  3. 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.

  4. Accessing an uninitialized local variable will result in a compile-time error.

  5. 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



CONTACT DETAILS

info@prowessapps.in
(8AM to 10PM):

+91-9026070669 , +91-9451396824

© 2016, prowessapps.in, All rights reserved