Interface Java Interview Questions – Set 13

Which one would you prefer and why The Runnable interface is preferred, as it does not require your object to inherit a thread because when you need multiple inheritance, only interfaces can help you. In the above example we had to extend the Base class so implementing Runnable interface is an obvious choice. Also note how … Read more

Interface Java Interview Questions – Set 12

What is JSP Implicit Objects Certain objects that are available for the use in JSP documents without being declared first. These objects are parsed by the JSP engine and inserted into the generated servlet. The implicit objects re listed below: request :It represents the request made by the client. The request implicit object is generally used … Read more

Interface Java Interview Questions – Set 11

Define TaskTracker. TaskTracker is a node in the cluster that accepts tasks like MapReduce and Shuffle operations from a JobTracker. What is the difference between HDFS and NAS? HDFS data blocks are distributed across local drives of all machines in a cluster whereas, NAS data is stored on dedicated hardware. What is the purpose of … Read more

Interface Java Interview Questions – Set 10

Performance of Set interface implementations HashSet The HashSet class offers constant-time [ Big O Notation is O(1) ] performance for the basic operations (add, remove, contains and size), assuming the hash function disperses the elements properly among the buckets. Iterating over this set requires time proportional to the sum of the HashSet instance’s size (the … Read more

Interface Java Interview Questions – Set 09

Why does JComponent have add() and remove() methods but Component does not because JComponent is a subclass of Container, and can contain other components and jcomponents. How can I implement a thread-safe JSP page? – You can make your JSPs thread-safe by having them implement the SingleThreadModel interface. This is done by adding the directive … Read more

Interface Java Interview Questions – Set 08

What is an observer design pattern The Observer pattern is a behavioral design pattern that  allows an object (an Observer) to watch another object (a Subject). The subject and observer to have a publish/subscribe relationship. Observers can register to receive events from the Subject. Some of the practical uses of observer pattern are: When a … Read more

Interface Java Interview Questions – Set 07

What is a Session? Can you share a session object between different threads Session is a light weight and a non-threadsafe object (No, you cannot share it between threads) that represents a single unit-of-work with the database. Sessions are opened by a SessionFactory and then are closed when all work is complete. Session is the … Read more

Interface Java Interview Questions – Set 06

When can an object reference be cast to an interface reference An object reference be cast to an interface reference when the object implements the referenced interface. What is a cloneable interface and how many methods does it contain ?– It is not having any method because it is a TAGGED or MARKER interface. What … Read more

Interface Java Interview Questions – Set 05

When does the compiler insist that the class must be abstract If one or more methods of the class are abstract. If class inherits one or more abstract methods from the parent abstract class and no implementation is provided for that method If class implements an interface and provides no implementation for those methods How … Read more

Interface Java Interview Questions – Set 04

What is the difference between the JDK 1.02 event model and the event-delegation model introduced with JDK 1.1? The JDK 1.02 event model uses an event inheritance or bubbling approach. In this model, components are required to handle their own events. If they do not handle a particular event, the event is inherited by (or … Read more