I have got some doubts in java basics
1) what is the difference between String equals() method and '== 'operator,
as per my knowledge '==' compares the reference nos of the object and equals() compares the content of the object.
when I tried this example with '==' operator it is showing strings are not equal
String s1 = "Test";
String s2 = new String("Test");
but reference no s are same...i know that new operator will create new String object....but why it is giving same hashcode(reference no).
2 ) what is the use FactoryMethods in java...they are used to create the object of the class to which method belongs....in real scenario when we will use FactoryMethods in our own class.
3) what is the advantage of interface compare to abstract class .....what i know is we can't extend more than one class but we can implement multiple interfaces....is that the only advantage or any thing else. I mean we can declare all the abstract class methods are abstract....so any class extends this abstract class must implement the methods.
4) wait(),notify(),notifyAll()....methods are used in Thread communication, even though they are used only in Thread class....why they are in Object class.