Wednesday 6 July 2016

Difference between Interface and Absract Class
























Difference between "== operator" and "equals() method"

"= = operator" is for reference comparison
while
".equals() method" is for content comparison

for example:-

String s1= new String("Happy");
String s2= new String("Happy");

S.O.P (s1==s2)  /// returns false ,as reference of both these are different
while
S.O.P (s1.equals(s2)) /// returns true , as content wise both these are same.i.e. both has same content( "Happy")



 But there is a Loophole


Differences between String and StringBuffer

String are immutable (i.e. non-changeable) ,so we cannot change the object, if we try to do the change another object will be created.

StringBuffer are mutable (i.e. changeable) ,so we can perform the change on the object.


Difference Between final, finally and finalize

All these three (final ,finally and finalize) are totally different. The Only Similarity among these three are their names. :P