| Other Core Java Interview Questions |
| |
| Question | Asked @ | Answers |
| |
| Describe inheritance as applied to java? | | 4 |
| public 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 | 3 |
| what is the difference between Java Command Line and C
command Line? | | 1 |
| what is the life cycle of jsp? | Photon | 1 |
| what is a static block? | | 3 |
| What are File and RandomAccessFile classes? | | 1 |
| Explain different ways of passing arguments to sub-routine? | | 1 |
| How many ways can an argument be passed to a subroutine? | | 1 |
| How do you load an HTML page from an Applet ? | | 1 |
| write a progam hashmap & hashtable? | IBM | 1 |
| Difference between a Scrollbar and a ScrollPane? | | 1 |
| watz the difference between abstract class and interface?
Which one u ill choose as a designer? | Sonata | 1 |
| Does any tag exists in HTML to upload and download files ? | | 2 |
| How many methods does cloneable interface contains? | | 2 |
| how can u apply shallow cloning and deep cloning to create
object? | Yash-Technologies | 1 |
| Different types of Layouts? | | 3 |
| Explain Global variables in Packages? | | 1 |
| How to create an instance of a class without using "new"
operator? Plz help me out properly.Thank u. | CSC | 6 |
| What is the frontend and backedn in Java? | TCS | 2 |
| Write java code to print "Hello how are you"
Thread1 should have "Hello"
Thread2 should have "how are you"
both the threads should start at the same time | Huawei | 1 |
| |
| For more Core Java Interview Questions Click Here |