Data Types in Java 7

In this section we will discuss Java 7 Data Types.

Data Types in Java 7

In this section we will discuss Java 7 Data Types.

Data Types :

Data types are the keywords stored in the reserved memory which we use to define type of variables.
There are two types of data types defined in java 7 -

  • Primitive data types
  • Reference data types

Primitive Data Types:

Primitive data types is already defined and represented by the reserved keyword. Value of primitive type don't share state with another primitive values. Java 7 supports eight primitive data types -

  1. byte
  2. short
  3. int
  4. long
  5. float
  6. double
  7. boolean
  8. char

Reference data types :

Non-primitive data types are also called reference data types. It is handled by reference. These refer to objects and arrays. it is created by defining constructor of a classes. You can use it to access the objects.

Literals :

When you initialize variable of primitive type, do not use new keyword. we built into the language. Literal is source code representation of a fixed value. It represents directly to your code without requiring computation. literals are used to assign to any primitive type variable.

Example :

short value = 40;
 boolean test = true;

Advertisements

Share on Google+Share on Google+

Data Types in Java 7

Posted on: December 18, 2012 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Advertisements

 

Discuss: Data Types in Java 7  

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:0

Ads

 

Ads