Share on Google+Share on Google+

Java - Identifier and primitive datatype in java

In this example you will learn what is identifier and primitive data type of a identifier. This tutorials will teach you how to use these identifier in you java programming.

Java - Identifier and Primitive Data Types in java


In this example you will learn what is identifier and primitive data types of a identifier. This tutorials will teach you how to use these identifier in you  java programming. Identifier is is a simple variable name which is defined as the value container. The type of value stored by identifier is defined by the special java keyword is termed as primitive data type.

In the given example there are some identifiers have been used like byteident, shortident, intident, longident, charident, stringident, floatident, doubleident. And there are some primitive data types of used identifiers have been also used in the program like byte, short, int, long, float, double, char and String. 

All the data type has it's own capacity to keep the maximum value. Which have been mentioned below : 

Primitive Data Types
Keyword Description Size/Format
byte Byte-length integer 8-bit two's complement
short Short integer 16-bit two's complement
int Integer 32-bit two's complement
long Long integer 64-bit two's complement
Real numbers
float Single-precision floating point 32-bit IEEE 754
double Double-precision floating point 64-bit IEEE 754
Other types
char A single character 16-bit Unicode character
boolean A boolean value (true or false) true or false

Code of the Program : 

public class identifierandpdatatype{
  public static void main(String[] args){
  byte byteident = 3;
  short shortident=100;
  int intident = 10;
  long longident = 40000;
  char charident = 'a';
  String stringident = "chandan";
  float floatident = 12.0045f;
  double doubleident = 2333333.000000000033343343434f;
  System.out.println(byteident + " is the value of identifire 

named 'byteident' which primitive data type is byte.");
  System.out.println(shortident + " is the value of 

identifire named 'shortident' which primitive data type is short.");
  System.out.println(intident + " is the value 

of identifire named 'intident' which primitive data type is int.");
  System.out.println(longident + " is the value 

of identifire named 'longident' which primitive data type is long.");
  System.out.println(charident + " is the value 

of identifire named 'charident' which primitive data type is char.");
  System.out.println(stringident + " is the value

 of identifire named 'stringident' which primitive data type is string.");
  System.out.println(floatident + " is the value 

of identifire named 'floatident' which primitive data type is float.");
  System.out.println(doubleident + " is the value

 of identifire named 'doubleident' which primitive data type is double.");

Download Identifier and primitive data types Example



Posted on: June 4, 2007 If you enjoyed this post then why not add us on Google+? Add us to your Circles

Share this Tutorial Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Discuss: Java - Identifier and primitive datatype in java   View All Comments

Post your Comment

Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
Clinton Smith
September 20, 2011
java programming

how to write identifiers for A grade on mid-term exam, The total number of courses, The total numbers of classmates, and the Average grade of the test.
Aisha Abubakar Shema
June 8, 2012

thats good
September 18, 2012

this program is rong.............!!!!!!
sandeep rai
November 14, 2012

class { public static void main(String[] args) { int i=0; i = i--; System.out.println("i"); } }