Monday, 30 June 2014

J2EE Interview Questions

Servlet Life Cycle?
How many ways to create the Servlet?
What is the diffrent between redirect and sendRedirect?
What is the diffrent between forward and include?

What is Different between "==" operator and equals()?

"==" Operator :

1. It is an operator applicable for primitivies and Object references.
2. In the case of Object references == operator is always ment for reference Comparision.
3. We con't override  "==" operator for content comparision.
4. In the case of heterogenious of Objects " ==" operator causes compile time error saying incomparable            types.
5. for any object reference r, r==null is always false.

equals() :

1. It is method of an Object class applicable Only for Object references.
2. We can override equals() for content comparision.
3. In the case of heterogenious objects equals() method simply returns false.
4. for any object reference r, r.equals(null) is always false.

Interview Questions for java

Different between String and StringBuffer?
Different between StringBuffer and StringBuilder?
Why String Objects are immutable?
What is the String constant pool?
What is the methods of Object class?
What is different between Comparator and Comparable interfaces?
What is different between "==" operator and equals()?
What is Synchronization?
What is the marker interface?
What is Abstraction,Encapulation and Polymorphism?
What is the static polymorphism and Dynamic polymorphism?
Different between method overloding and overriding?
What is the interface and abstraction?
Different between abstraction and interface?
Which senario is suitable abstraction and interface?
What are the access modifiers?
Diffrent between protected and default packages?
What is diffrent between error and Exception?
What are Checked and Unchecked Exception?
Which situation occure NullPointerException?
What is Thread Life cycle?
Different between wait() and sleep() mthods?
Different between yeild() and join()?
How many ways to create the thread and which is best approach?
What is the Collection? what is the advantage collections overe the arrays?
What is the diffrent between Set and List?
What is the diffrent between HashSet and HashMap?
What is the diffrent between ArrayList and Vector?
What is the diffrent between Hashtable and HashMap?
What is the diffrent between TreeSet and TreeMap?
What is the generic class?
What is the SingleTon class?Example
What is the factory method?
What is the Serialization and Deserialization?
What is the transient keyword in java?


Thursday, 12 June 2014

Java Interview Quetions and Answers Java

What is the Difference between HashMap and Concurrent HashMap?

  1. ConcurrentHashMap is thread-safe that is the code can be accessed by single thread at a time .    
         while HashMap is not thread-safe 
  2.  ConcurrentHashMap synchronizes or locks on the certain portion of the Map . To optimize the performance of ConcurrentHashMap , Map is divided into different partitions depending upon the Concurrency level . So that we do not need to synchronize the whole Map Object.

     3.   ConcurrentHashMap does not allow NULL values . So the key can not be null in
         ConcurrentHashMap .While In HashMap there can only be one null key .

     4.   In multiple threaded environment HashMap is usually faster than ConcurrentHashMap . As only single              thread can access the certain portion of the Map and thus reducing the performance, While in                          HashMap any number of threads can access the code at the same time.

What are the methods of Objects class?
  1. clone()
  2. equals(Object)
  3.  finalize()
  4.  getClass()
  5.  hashCode()
  6.  notify()
  7.  notifyAll()
  8.  toString()
  9.  wait()
  10.  wait(long)
  11.  wait(long, int)
What is the marker interface?

    If interface wont contain any methods, by implementing that interface if our object will get ability such type of interfaces are called marker interface.
  Exmaples;
  1.  java.lang.Cloneable
  2. java.io.Serializable
  3. java.util.EventListener.  etc

Wednesday, 11 June 2014