Back to Top

Saturday, 11 January 2014

JAVA: Data Types Conversion Chart

      In Java Programming Language, we must declare a variable name and type, before using it. The data type of a variable defines the the type of value it will contain. Java supports total 8 types of primitive data types. The name of this data types are all reserved as keywords.
Among which, 1) byte, 2) short, 3) int & 4) long can store integer values of different range.
5) float and 6) double can store floating numbers of different range.
7) boolean  can store only true/false. It is used as flag, to perform boolean operation.
8) char can store a single 16-bit Unicode character of range from '\u0000' (0) to '\uffff' (65,535).
Apart from these, Java also provides a String data type which is defined as a Class (java.lang.String). It can contains alpha numeric values.


  • Type: Integer (8-bit signed two's complement integer).
  • Range:  from -128 [-2^(8-1)] to 127 [(2^(8-1))-1].
  • Memory: 1 byte
  • Default Value : 0
  • Example: byte b = 0;


  • Type: Integer (16-bit signed two's complement integer).
  • Range:  from -32768 [-2^(16-1)] to 32767 [(2^(16-1))-1].
  • Memory: 2 bytes
  • Default Value : 0
  • Example: short s  = 0;

  • Type: Integer (32-bit signed two's complement integer).
  • Range:  from -2147483648 [-2^(32-1)] to 2147483647 [(2^(32-1))-1].
  • Memory: 4 bytes
  • Default Value : 0
  • Example: int i = 0;


  • Type: Integer (64-bit signed two's complement integer).
  • Range:  from -9223372036854775808 [-2^(64-1)] to 9223372036854775807 [(2^(64-1))-1].
  • Memory: 8 bytes
  • Default Value : 0L
  • Example: long l = 0L;


  • Type: Float (Single precision 32-bit IEEE 754 floating point).
  • Range:  from 1.4E-45F to 3.4028235E+38F.
  • Memory: 4 bytes
  • Default Value : 0.0f
  • Example: float f = 0f;


  • Type: Float (Single precision 64-bit IEEE 754 floating point).
  • Range:  from 4.9E-324D to 1.7976931348623157E+308D.
  • Memory: 8 bytes
  • Default Value : 0.0d
  • Example: double d = 0d;


  • Type: boolean (boolean flag - true / false).
  • Range:  NA.
  • Memory: virtual machine dependent
  • Default Value : false
  • Example: boolean b = false;


  • Type: Character (a single 16-bit Unicode character).
  • Range:  from '\u0000' (0) to '\uffff' (65535).
  • Memory: 2 bytes
  • Default Value : '\u0000'
  • Example: char c = '\u0000';


  • Type: String Character (a class can store alpha numeric value).
  • Range:  NA
  • Memory: NA
  • Default Value : null
  • Example: String s = "Hello World";

Anijit Sarkar

12 Responses to “ JAVA: Data Types Conversion Chart ”

Hardcoded said...
15 January 2014 at 20:05

You shouldn't use Boolean/Byte/Short/Integer/Long.valueOf(String) to get a (native) boolean/byte/... It's like calling:
byte b = Byte.valueOf(Byte.parseBoolean(string));

Hardcoded said...
16 January 2014 at 14:51

The byte to String conversion doesn't convert the byte value to a String representation, it treats the byte as a character of the plattforms default charset. So this is most likely the wrong method to convert a byte to String

asitbangalorereviews said...
19 August 2015 at 18:11

Very useful...

Mac Haik said...
2 October 2016 at 16:15

Thanks and Impressive Article. Outsourcing Data Conversion requirements of many a business has proven to be vital and wise decision. It helps them to function effectively and save a considerable amount of time and money. IT Outsourcing Services offer to convert your data into a powerful management resource. However difficult, complex or voluminous be your data conversion project, we will get it completed quickly and cost effectively. With the support of experienced team of Data Conversion professionals and state-of-the-art technology, we can obtain data from virtually any media source or file and convert it into usable formats. Our experience and capability to provide the complete Data Conversion solutions make us leaders in the industry.

Naviya Nair said...
24 October 2016 at 14:58

I have read your blog its very attractive and impressive. I like it your blog.

Java Training in Chennai Java Training in Chennai | Core Java Training in Chennai

Online Java Training Java 8 Online Training | Java J2EE Online Training | JavaEE Training Institute in Chennai Java Training Institutes

Java Training Institutes in Chennai Java Training in Chennai

shasthika said...
23 March 2017 at 12:37

perfect explanation about java programming .its very useful.thanks for your valuable training in chennai | chennai's no.1 java training in chennai

Geetha Devi said...
25 March 2017 at 11:51

Very informative ..i suggest this blog to my friends..Thank you for sharingjava training in chennai | chennai's no.1 java training in chennai

shasthika said...
25 March 2017 at 13:04

perfect explanation about java programming .its very useful.thanks for your valuable training in chennai | java training in velachery

vignesjoseph said...
8 June 2017 at 16:26

Identifiers are the names of variables, methods, classes, packages and interfaces. Unlike literals they are not the things themselves, just ways of referring to them.
Software Testing Training in Chennai
Software Testing Training Institute in Chennai

Aswin Karthick said...
8 November 2017 at 15:56

thank you seo training in chennai
hibernate training in chennai
spring training in chennai

nivedhitha reddy said...
22 December 2017 at 16:58

Thanks for information Hadoop developer training

Unknown said...
22 January 2018 at 15:40

• Nice and good article. It is very useful for me to learn and understand easily. Thanks for sharing your valuable information and time. Please keep updatingAzure Online course hyderabad

Post a Comment

Popular Posts

All Rights Reserved JAVA INTERVIEW QUESTIONS | Privacy Policy | Anijit Sarkar
blog links Web Directory Academics Blogs