Primitive Data Types – Integer

Primitive Data Types in Java – Integer

Primitive data types are very important in any language. Without this data types we cannot understand  programming language. We can also called primary data types in java. In this primitive data types we found four types of family like Integer, Float, Character and Boolean. And these families have their own children like Integer [byte, short, int and long], Float [float, double], Character [char] and Boolean [Boolean].

In this blog we will discuss on Integer Family:

Integer Data Type

NoData TypesSizeRang
1byte 1 byte-128 to 127
2short 2 byte-32768 to 32768
3int 4 byteMore than short
4long4 byteMore than int

 

Program in Integer Data Types:

Title: Primary Data Type – Integer

class data1

{

public static void main(String args[])

{

byte b1 = 45;

System.out.println(b1);

byte b2 = (byte)130;

System.out.println(b2);

// **** short Ex ***

short s = 4543;

System.out.println(s);

}

}

Output:

45

-126

4543

 

You can also see this program in YouTube.

 

 

Tutorial – Try Yourself

Tutorial – 1 : Find the volume of cube.

Tutorial – 2 : Find sum and average of 6 numbers.

Tutorial – 3 : Find CM And M Form Kilometer. [Need long integer..]

 

[sbscrbr_form]

 

If you have problem on this blog, you can directly comment on it.

How to Set Environment Variable | How to Earn Money Online

Share and Enjoy

  • Facebook
  • Twitter
  • Delicious
  • LinkedIn
  • StumbleUpon
  • Add to favorites
  • Email
  • RSS

246total visits,2visits today


mayank

Hello, I am Maddy a Java blogger, trainer and developer

Related articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Your comments (*)

Name (*)

Your full name please.

Email address (*)

Used for gravatar.

Website

Link back if you want.

Enter Captcha Here :*

Reload Image

EmailEmail
PrintPrint