Pages

Interview Questions

Question.1 Collections API?
 
--  Collections API is a set of classes and interfaces which provides methods to do different operation on a collections of objects.
--  Collections class are ArrayList, HashMap, LinkedList.
--  Collections interfaces are Set, Map, List and Collection.

Question.2  String Vs StringBuffer?

-- String is immutable.StringBuffer can be changed.And StringBuilder can also be changed.

Question.3  StringBuffer vs StringBuilder?

-- StringBuffer is synchronized while StringBuilder is unsynchronized.

- If your variable is not going to change then use a String.
- If your variable will be used by only one thread then use StringBuilder.
- If your variable will be used by more then one threads then use StringBuffer.

Question.4  Synchronization?

-- Used with the Multi-Threaded Programming in Java,

-- Without synchronization it is possible for one thread to modify a shared object while another thread is in the process of using or updating that object's value.

Question.5 HashMap vs HashTable?

-- HashMap permits null while HashTable doesn't.

-- HashMap is not synchronized. HashTable is synchronized.

-- In HashMap order of the map can change with.

Question. 6  Set  vs List?

-- Set does not contain duplicate elements whereas List can have.

-- Set's elements are unordered while List's are ordered.
  
Question. 7  Vector vs ArrayList?

--  Vector has a default size of  Ten(10) while ArrayList has no default size.

--  Vector is synchronized so can be used in multithreading environment while ArrayList is not.

Question. 8  Iterator vs ListIterator?
 
-- Iterator enables you to cycle(Travers and modification of elements) in forward directions while in ListIterator we can cycle in both directions.

Question. 9  Access modifiers in Java?

-- Access modifiers are Private, Protected, Default, Public.

Question. 10  Non - Access modifiers in Java?

-- Non - Access modifiers are final, abstract, transient, synchronized, native, strictfp, static.

Question. 11  object class?

-- Every class in Java inherits object class explicitly or we can say class object is the super class for all classes. Class object has an equals() method, clone() method, notify() method and wait() method.