Hi Anyone know the model / questions of the Federal bank sample questions for the post of Specialist Officers - Programmers. Please post if anyone have..
2307public class AboutStrings{ public static void main(String args[]){ String s1="hello"; String s2="hel"; String s3="lo"; String s4=s2+s3; //to know the hash codes of s1,s4. System.out.println(s1.hashCode()); System.out.println(s4.hashCode()); // these two s1 and s4 are having same hashcodes. if(s1==s4){ System.out.println("s1 and s4 are same."); }else System.out.println("s1 and s4 are not same."); } } Somebody told me that, == operator compares references of the objects. In the above example even though s1 and s4 are refering to same object(having same hash codes), it is printing s1 and s4 are not same. Can anybody explain in detail why it is behaving like this? Thanks in Advance RavuriVinod
TCS,
4 7629if two references are having same hash codes,is that means those are refering to same object?
CTS,
5 11094
What are inbuilt functions in java?
What is a methodologist?
What is local declaration?
What is an image buffer?
Explain the difference between static and dynamic binding in java?
From the two, which would be easier to write: synchronization code for ten threads or two threads?
What is a cup of java?
What is the difference between the font and fontmetrics classes in java programming?
Is singleton class immutable?
What are advantages and disadvantages of OOPs?
Explain exception chaining in java?
When is the finalize() called? What is the purpose of finalization?
How an object is serialized in java?
Why does java does not support multiple inheritance? Explain
How many types of equations are there?