DATA TYPES IN JAVA Learning with RD
CREATED BY – RAHUL DAREDIA
Data Types in java
Primitive Non - Primitive
Numeric Non-
Numeric
Classes Interface Array
Integ
er
Floati
ng
point
Cha
r
Boolea
n
CREATED BY – RAHUL DAREDIA
Data
types
Description Range
From To
Byte Integer value (8 -bits) or 1 byte -128 127
Short Integer value (16 -bits) or 2 byte -32768 32767
Int Integer value (32 -bits) or 4 byte -
214748464
8
214748464
7
Long Integer value -
922337203
685477580
8
-
922337203
685477580
7
Float Real number(32 –bits) or 4 byte The
maximum is
about 10
raised to
the power
38
Double Real number(64 –bits) or 8 byte The
maximum is
about 10
raised to
The single character from
the Unicode character set.
False or True
CREATED BY – RAHUL DAREDIA
INTEGERS
This group includes byte, short , int , and long, which are for
whole – valued signed number.
CREATED BY – RAHUL DAREDIA
FLOATING-POINT NUMBER
This group includes float and double , which represent numbers
with fractional precision.
CREATED BY – RAHUL DAREDIA
CHARACTERS
This group includes char , which represents symbols in a character
set, like letters and numbers.
CREATED BY – RAHUL DAREDIA
BOOLEAN
This group includes Boolean , which is a special type for
representing true/false values.
CREATED BY – RAHUL DAREDIA
INTEGER TYPE
•Java defines four integer types : Byte , short , int and long
•All of these are signed , positive and negative values.
•Java does not support unsigned , positive-only integers.
•The width of an integer type should not be throught of as the
amount of storage it consumes, but rather as the behavior it defines
for variables and expression of that type.
•The width of an integer type should not be thought of as the
amount of storage it consumes, but rather as the behavior it defines
for variables and expressions of that type.
•The width and ranges of these integer types vary widely , as
shown in this table. CREATED BY – RAHUL DAREDIA
Name Width Range Example
Long 64 -
9,223,372,036,854,775
,808 to
9,223,372,036,854,775
,807
Long b ,c ;
int 32 -2,147,483,648 to
2,147,483,647
int a , b;
short 16 -32,768 to 32,767 Short c , d;
Byte 8 -128 to 127 byte a , b;
CREATED BY – RAHUL DAREDIA
FLOATING-POINT TYPES
•Floating-point numbers, also known as real numbers , are used
when evaluating expressions that require fractional precision.
•Ex. Calculations such as square root, or transcendental such as
sine and cosine, result in a value whose precision requires a
floating-point type.
•There are two kinds of floating-point types, float and double,
which represent single and double- precision numbers,
respectively. Their width and ranges are shown here
CREATED BY – RAHUL DAREDIA
Name Width in bits Range Example
Double 64 1.7e-308 to 1.7e+308 Double a , d;
Float 32 3.4e-038 to 3.4e +
038
Float a , b;
CREATED BY – RAHUL DAREDIA
CHARACTER TYPE
•In java, data type used to store character is char.
•Java uses Unicode to represent character.
•Unicode defines a fully international character set that can
represent all of the character found in all human language.
•The ranges of char is 0 to 65,536.
CREATED BY – RAHUL DAREDIA
BOOLEAN TYPE
•Java has a simple type, called Boolean , for logical values.
•It can have only one or two possible values, true or false.
•This is the type returned by all relational operators, such as a<b.
•Boolean is also the type required by the conditional expressions
that gove4rn the control statement such as if and for.
CREATED BY – RAHUL DAREDIA
THANK YOU
CREATED BY – RAHUL DAREDIA
Also understand DATA TYPES IN JAVA on YOUTUBE search Learning
with RD and click DATA TYPES IN JAVA .

Data types in java | What is Datatypes in Java | Learning with RD | Created by Rahul Daredia.

  • 1.
    DATA TYPES INJAVA Learning with RD CREATED BY – RAHUL DAREDIA
  • 2.
    Data Types injava Primitive Non - Primitive Numeric Non- Numeric Classes Interface Array Integ er Floati ng point Cha r Boolea n CREATED BY – RAHUL DAREDIA
  • 3.
    Data types Description Range From To ByteInteger value (8 -bits) or 1 byte -128 127 Short Integer value (16 -bits) or 2 byte -32768 32767 Int Integer value (32 -bits) or 4 byte - 214748464 8 214748464 7 Long Integer value - 922337203 685477580 8 - 922337203 685477580 7 Float Real number(32 –bits) or 4 byte The maximum is about 10 raised to the power 38 Double Real number(64 –bits) or 8 byte The maximum is about 10 raised to The single character from the Unicode character set. False or True CREATED BY – RAHUL DAREDIA
  • 4.
    INTEGERS This group includesbyte, short , int , and long, which are for whole – valued signed number. CREATED BY – RAHUL DAREDIA
  • 5.
    FLOATING-POINT NUMBER This groupincludes float and double , which represent numbers with fractional precision. CREATED BY – RAHUL DAREDIA
  • 6.
    CHARACTERS This group includeschar , which represents symbols in a character set, like letters and numbers. CREATED BY – RAHUL DAREDIA
  • 7.
    BOOLEAN This group includesBoolean , which is a special type for representing true/false values. CREATED BY – RAHUL DAREDIA
  • 8.
    INTEGER TYPE •Java definesfour integer types : Byte , short , int and long •All of these are signed , positive and negative values. •Java does not support unsigned , positive-only integers. •The width of an integer type should not be throught of as the amount of storage it consumes, but rather as the behavior it defines for variables and expression of that type. •The width of an integer type should not be thought of as the amount of storage it consumes, but rather as the behavior it defines for variables and expressions of that type. •The width and ranges of these integer types vary widely , as shown in this table. CREATED BY – RAHUL DAREDIA
  • 9.
    Name Width RangeExample Long 64 - 9,223,372,036,854,775 ,808 to 9,223,372,036,854,775 ,807 Long b ,c ; int 32 -2,147,483,648 to 2,147,483,647 int a , b; short 16 -32,768 to 32,767 Short c , d; Byte 8 -128 to 127 byte a , b; CREATED BY – RAHUL DAREDIA
  • 10.
    FLOATING-POINT TYPES •Floating-point numbers,also known as real numbers , are used when evaluating expressions that require fractional precision. •Ex. Calculations such as square root, or transcendental such as sine and cosine, result in a value whose precision requires a floating-point type. •There are two kinds of floating-point types, float and double, which represent single and double- precision numbers, respectively. Their width and ranges are shown here CREATED BY – RAHUL DAREDIA
  • 11.
    Name Width inbits Range Example Double 64 1.7e-308 to 1.7e+308 Double a , d; Float 32 3.4e-038 to 3.4e + 038 Float a , b; CREATED BY – RAHUL DAREDIA
  • 12.
    CHARACTER TYPE •In java,data type used to store character is char. •Java uses Unicode to represent character. •Unicode defines a fully international character set that can represent all of the character found in all human language. •The ranges of char is 0 to 65,536. CREATED BY – RAHUL DAREDIA
  • 13.
    BOOLEAN TYPE •Java hasa simple type, called Boolean , for logical values. •It can have only one or two possible values, true or false. •This is the type returned by all relational operators, such as a<b. •Boolean is also the type required by the conditional expressions that gove4rn the control statement such as if and for. CREATED BY – RAHUL DAREDIA
  • 14.
    THANK YOU CREATED BY– RAHUL DAREDIA Also understand DATA TYPES IN JAVA on YOUTUBE search Learning with RD and click DATA TYPES IN JAVA .