Int And Integer?

Dear All..

I am a rookie of Java and i have a stupid problem..

Is there any defferent from

int a = 1;

and

Integer a =new Integer(2);

it makes me so confuse,can anyone explain for me ..

thanks a lot

[350 byte] By [wthomasu] at [2007-9-26 1:36:38]
# 1

int is a primitive, whereas Integer is a primitive wrapper, a true java object. Objects have constructors, methods and member variables, primitives do not. The diffrence is very significant, particularly as it pertains to operations you can perform on an object as opposed to a primitive data type.. I know this is brief and not quite complete but hopefully you get the point,, at least enough to investigate the differneces on yor own.

J.Prisco at 2007-6-29 2:22:25 > top of Java-index,Archived Forums,Java Programming...