All code in my posts, unless a source is explicitly mentioned, is my own.
Thanks,
Alps
Alpesh Rathod wrote:Well Keep one thing in mind that when its dealing with objects always use ==,because == always checks for location and not content whereas equals checks for content.
String is the only class which is not initialized wth new...and hence if the instance is of type String then we always go for equals method.
I hope i have cleared the things properly..if not rectify if possible...
All code in my posts, unless a source is explicitly mentioned, is my own.
SCJP 6
Thanks,
Alps
String is not the only class which is not initialized with new, the wrapper classes can be declared and initialized in one line using autoboxing without using the new keyword.
Abhi vijay wrote:
String is not the only class which is not initialized with new, the wrapper classes can be declared and initialized in one line using autoboxing without using the new keyword.
Please, can someone elaborate?
All code in my posts, unless a source is explicitly mentioned, is my own.
Abhi vijay wrote:
String is not the only class which is not initialized with new, the wrapper classes can be declared and initialized in one line using autoboxing without using the new keyword.
Please, can someone elaborate?
SCJP 6
Why to worry about things in which we dont have control, Why to worry about things in which we have control ! !
All code in my posts, unless a source is explicitly mentioned, is my own.
Abhi vijay wrote:
I dont understand why line1 is giving TRUE and line2 FALSE???
SCJP 6
equals(Object o){
if(!(o instanceof Integer))
return false;
....
....
}
SCJP 6