33 Java Interview Questions
WOW_007.jpg

Typical HR Questions

1. What are the thread states in java ?


2. List all the types of nested class ?


3. How to increase the heap memory of the JVM ?


4. Name three JVMs ?


5. What is the quickest type of Map ?


6. How do you redirect the System.out ( "standard" output stream ) to a file ?


7. A class that supports serializarion must implement serializable, if its base class is not serizable then what must it have. ?


8. Which method should you override when writing a Customer Class Loader ?


9. Name the standard class loaders ?


10. What is the signature of readResolve() and what is it used for ?


11. Other than using externizable, how can you handle custom serilization ?


12. In java 6, how can you see the assembly code that the JIT is creating ?


13. Name 10 Ways to Reduce Lock Contention in Threaded Programs ?


14. List 4 Collection Classes and 4 Collection Interfaces ?


15. How do you create an array using reflection


16. Describethe following exceptions : CloneNotSupportedException, ClassNotFoundException, ArrayStoreException, ClassCastException, ConcurrentModificationException, IllegalMonitorStateException, UnsupportedOperationException.


17 With java collections, whats the difference between Offer(E e) and Add(E e).


18 Can a top level class be have a protected class modifier


19 Does this produce a runtime error

public class Test {

    public static void main(String... args) {

        Object o = new Object() {
            public boolean equals(Object t) {
                return t.equals("hi");
            }
        };

        System.out.println(o.equals("hi"));
    }
}

20 What is the difference between weak and soft references


21 What is the difference between NoClassDefFoundError and a ClassNotFoundException


22 When should you use Serializable and when should you use Externalizable


23 How do you create a singleton


24 What is the difference between parameters and arguments


25 what is escape analysis


26 what are memory barriers


27 how/when does instruction reodering occur in java


28 what is object orientation


29 explain double checked locking


30 is there ever a case when a singleton may return a differnt instance


30 what is instruction reordering and when / where is it used

31 If the compareTo method of a comparable object returns zero are they equal

32 what are synthetic bridge methods

33 write a class that implements the following :

  • if the object has been seen before, returns the same integer
  • if the object has not been seen before returns a different integer.
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License