Skip to main content

Posts

Showing posts from October 1, 2017

Interview Questions in Core Java

Interview Questions in Core Java 1.what is a transient variable? A transient variable is a variable that may not be serialized. 2.which containers use a border Layout as their default layout? The window, Frame and Dialog classes use a border layout as their default layout. 3.Why do threads block on I/O? Threads block on i/o (that is enters the waiting state) so that other threads may execute while the i/o Operation is performed. 4. How are Observer and Observable used? Objects that subclass the Observable class maintain a list of observers. When an Observable object is updated it invokes the update() method of each of its observers to notify the observers that it has changed state. The Observer interface is implemented by objects that observe Observable objects. 5. What is synchronization and why is it important? With respect to multithreading, synchronization is the capability to control the access of multiple threads to shared resources. Without synchronization, it is

Java Collections Interview Questions and Answers

Beginner Level (0-1 yr): Java Collections Interview Questions  and Answers Q1  What is Collection ? What is a Collections Framework ? What are the benefits of Java Collections Framework ? Collection :  A collection (also called as container) is an object  that groups multiple elements into a single unit. Collections Framework :  Collections framework provides unified architecture for manipulating and representing collections. Benefits of Collections Framework : 1. Improves program quality and speed 2. Increases the chances of reusability of software 3. Decreases programming effort. Q2 What is the root interface in collection hierarchy ?  Root interface in collection hierarchy is  Collection interface .  Few interviewer may argue that  Collection interface extends  Iterable interface . So iterable should be the root interface. But you should reply iterable interface present in java.lang package not in java.util package .It is clearly mentioned in  Oracle Collection  docs  , that Collec