Java Interview Questions

Jjava Interview Questions

Set 4 – Java, Oracle, Unix Interview Questions

1. What is the index position of element 10 in the Stack? Stack st = new Stack(); st.push(10); st.push(20); st.push(30); 1. 0 2. 1 3. 2 4. 3 2. With what you can fill up the blank so that the output is Hyderabad. List cities = new ArrayList(); cities.add(“Hyderabad”); ——- abc = cities.get(0); System.out.println(abc); 1. …

Set 4 – Java, Oracle, Unix Interview Questions Read More »

Set 3 – Java, Oracle, Unix Interview Questions

1. Which interface is not in the Collection hierarchy? 1. List 2. Set 3. Map 4. Queue 2. What is the output of the following snippet of code? Hashtable ht = new Hashtable(); StringBuffer sb1 = new StringBuffer(“hello”); ht.put(sb1, “sir”); Enumeration e = ht.keys(); while(e.hasMoreElements()) { Object obj1 = e.nextElement(); Object obj2 = ht.get(obj1); System.out.println(obj1 …

Set 3 – Java, Oracle, Unix Interview Questions Read More »

Set 2 – Java, Oracle, Unix Interview Questions

1. Following snippet of code String citiesArray[] = { “Hyderabad”, “Chennai”, “Vizag”, “Delhi” }; List citiesList = Arrays.asList(citiesArray); for(String temp : citiesList) { System.out.println(temp); } 1. raises compilation error 2. compiles but throws exception 3. compiles, executes and prints all the elements 4. last element is not printed 2. Observe, the following snippet of code. …

Set 2 – Java, Oracle, Unix Interview Questions Read More »

Set 1 – Java, Oracle, Unix Interview Questions

1.   compareTo(Object) belongs to which class? 1.  Collections 2.  Comparator 3.  Comparable 4.  Arrays 2. singletonList(Object) method is defined in? 1.  class ArrayList 2.  interface List 3.  interface Collection 4. class Collections 3.   When a thread is started with start() method, in which state it exists? 1.  born state 2.  runnable state 3. …

Set 1 – Java, Oracle, Unix Interview Questions Read More »

Test Your Java Tricky Questions

Test Your Java Tricky Questions Question 1 on Test Your Java Tricky Questions: What is the output of the following code? class Parent { public Parent() { this.display(); } public void display() { System.out.println(“In parent display method”); } } public class Child extends Parent { public Child() { this.display(); } public void display() { System.out.println(“In …

Test Your Java Tricky Questions Read More »

Networking Interview Questions

What is Socket? (of Networking Interview Questions) Socket is the end-point of communication for a system. A Socket constructor comes with two parameters of IP address of the other system where the communication should go and the port number on which the service is available on the server required by the client. What is ServerSocket? …

Networking Interview Questions Read More »

Applets Interview Questions

Read all Applets Interview Questions. What is an applet? (of Applets Interview Questions) Applet is a Java program with special syntax to execute in a browser. Applet does not contain main() method. What is the importance of applets in Java coding? (of Applets Interview Questions)Applets can be loaded on client-side so that they can communicate …

Applets Interview Questions Read More »

Exceptions Interview Questions

What is an exception?The English literature meaning is "something that happens unusually (very rarely)". It is the same meaning with Java also. Exception can be defined as a problem occurring at runtime that prevents the execution of the program. Or to say, an exception is a runtime problem (not compile time as compilation is already …

Exceptions Interview Questions Read More »

String StringBuffer Interview Questions

String StringBuffer Interview Questions Read well String StringBuffer Interview Questions. What is a String in Java?In Java, String does not terminate with \0. String is a class from java.lang package and can be manipulated with String class methods. How strings are immutable? In case of variables, if a variable value is changed, the value in …

String StringBuffer Interview Questions Read More »

Arrays Java Interview Questions

What is the advantage of arrays in a programming language? (of Arrays Java Interview Questions) Arrays avoid the declaration of a number of variables. With one array variable, number of values can be stored, using index numbers. What are the features of arrays in Java? (of Arrays Java Interview Questions) Same rules of C/C++ can …

Arrays Java Interview Questions Read More »

Object Casting Polymorphism Interview Questions

Note: Explanation is given avoiding more buzz words. Easily understandable manner. Object Casting Polymorphism Interview Questions What is casting? Converting one data type (or object) to the other is known as casting. It is required in a programming language as the user entered data may be in different form than required in coding. How many …

Object Casting Polymorphism Interview Questions Read More »