| Author |
question about wrapper objest
|
zhu weitao
Greenhorn
Joined: Sep 02, 2008
Posts: 9
|
|
What't the differences between "Integer a = 1;" and "Integer c = new Integer(1);"? And,why the result of "System.out.println(c==d);" is "false"
|
 |
Sagar Rohankar
Ranch Hand
Joined: Feb 19, 2008
Posts: 2896
|
|
|
Discussed many times , search this forum or Java Beginner section , and this recent thread discussed your doubt !
|
[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
|
 |
Seetharaman Venkatasamy
Ranch Hand
Joined: Jan 28, 2008
Posts: 5575
|
|
Hi, "==" tells whether references are refer to the same object or not. Integer i=new Integer(1); Integer j=new Integer(1); the Bold case are different object right? when you put something like this Integer a=1,b=1; //the both references pointing 1 so true
|
 |
 |
|
|
subject: question about wrapper objest
|
|
|