Sunday, 29 January 2012

Data Types in Java

What is a Data Type?
•Data type specifies the type of value(s) that a variable can store.
•Java is a strongly typed language. Strongly typed means, every variable must be declared before using them in the program.
•In Java there are eight (8) primitive data types. They are: byte, short, int, long, float, double, char and boolean.

Primitive data types:
•int – Used to store integer values.
•byte – Used to store integer values.
•short – Used to store integer values.
•long - Used to store integer values.
•float – Used to store real values.
•double – Used to store real values.
•char – Used to store character.
•boolean – It can store only two values, “true” and “false”

primitive types

3 comments:

  1. There are several mistakes in this range table:
    Char has range from 0 to 65535 (2^16 values)
    Int has range from -2^31 to 2^31-1 (2^32 values)
    Long has range from -2^63 to 2^63-1 (2^64 values)

    ReplyDelete
  2. Thank you man. I must be out my mind when I typed that lol :D

    ReplyDelete
  3. very informative blog. Helps to gain knowledge about new concepts and techniques. Thanks for posting information on this blog Software Testing Training in Chennai | Software Testing Training Institute in Chennai

    ReplyDelete