Tuesday, 5 June 2012

Difference between INTEGER and INT



What is the difference between Integer and int?


Integer is a class(Wrapper Class) defined in the "java.lang" package,where as int is a primitive data type.

Integer can be used as an argument for a method that requires an object,where as int can be used for calculations.

An int holds a number, whereas Integer is a pointer that can reference an object that contains a number.

Integer can handle null. For int null would become 0(zero) and int cannot express null.

Here's list of Wrapper Classes and Primitive Data Types available in Java.

Wrapper Class
Primitive data type
Integer
Int
Byte
byte
Character
char
Short
short
Double
double
Boolean
boolean
Long
long

1 comment:

  1. Okay...

    This may sound pretty creepy, and maybe even a little "strange"

    BUT what if you could simply push "Play" to LISTEN to a short, "miracle tone"...

    And magically attract MORE MONEY into your life?

    What I'm talking about is hundreds... even thousands of dollars!!!

    Think it's too EASY? Think it's IMPOSSIBLE??

    Well then, I've got news for you.

    Sometimes the greatest miracles in life are the easiest to GET!!!

    Honestly, I will provide you with PROOF by letting you listen to a REAL "miracle money tone" I've synthesized...

    (And COMPLETELY RISK FREE).

    You simply push "Play" and watch how money starts piling up around you... starting pretty much right away...

    GO here now to PLAY the marvelous "Miracle Money Tone" - as my gift to you!!!

    ReplyDelete