Home » Programming » What are Primitive Data Types in Java Language?

What are Primitive Data Types in Java Language?

8 September 2008

This is the question that might rise by the Java programming beginner. Well, the answer to this question is: Primitive Data Types are the type that is preliminary defined by the Language which normally known as Keywords or reserved words.

In Java Language there are 8 primitive data types supported.

  • byte: is an 8-bit signed two's complement integer. It has a minimum value of -128 and a maximum value of 127 (inclusive).
    Default value: 0
  • short: is a 16-bit signed two's complement integer. It has a minimum value of -32,768 and a maximum value of 32,767 (inclusive).
    Default value: 0
  • int: is a 32-bit signed two's complement integer. It has a minimum value of -2,147,483,648 and a maximum value of 2,147,483,647 (inclusive).
    Default value: 0
  • long: is a 64-bit signed two's complement integer. It has a minimum value of -9,223,372,036,854,775,808 and a maximum value of 9,223,372,036,854,775,807 (inclusive).
    Default value: 0L
  • float: is a single-precision 32-bit IEEE 754 floating point. The value range can be found here.
    Default value: 0.0f
  • double: The double data type is a double-precision 64-bit IEEE 754 floating point. The value range can be found here.
    Default value: 0.0d
  • boolean: has only two possible values: true and false.
    Default value: false
  • char: is a single 16-bit Unicode character. It has a minimum value of '\u0000' (or 0) and a maximum value of '\uffff' (or 65,535 inclusive).
    Default value: '\u0000'

Number and String are not primitive data type. They are java Object defined under java.lang. They come with subclass or methods for manipulating the value of the object itself.

Reference:

Author: Manet Yim Programming

630 views
  1. No comments yet.
  1. No trackbacks yet.