KyaPoocha.com

Huge Collection of Interview Questions


Archive for August, 2006

What are Checked and UnChecked Exception? 

A checked exception is some subclass of Exception (or Exception itself), excluding class RuntimeException and its subclasses. Making an exception checked forces... Read more »

How can one prove that the array is not null but empty using one line of code? 

Print args.length. It will print 0. That means it is empty. But if it would have ... Read more »

What is the first argument of the String array in main method? 

The String array is empty. It does not have any element. This is unlike C/C++ where... Read more »

What is an Iterator? 

Some of the collection classes provide traversal of their contents via a java.util.Iterator interface. This interface allows you to walk through a collection of... Read more »

Difference between Vector and ArrayList? 

Vector is synchronized whereas arraylist is not.  Read more »

Difference between HashMap and HashTable? 

The HashMap class is roughly equivalent to Hashtable, except that it is unsynchronized and permits nulls. (HashMap allows null values as key and value whereas Hashtable... Read more »

What is HashMap and Map? 

Map is Interface and Hashmap is class that implements that.  Read more »

What are pass by reference and passby value? 

Pass By Reference means the passing the address itself rather than passing the value. Passby Value means passing a copy of the value to be passed.  Read more »

Describe synchronization in respect to multithreading. 

With respect to multithreading, synchronization is the capability to control the access of multiple threads to shared resources. Without synchonization, it is possible... Read more »

What is the purpose of garbage collection in Java, and when is it used? 

The purpose of garbage collection is to identify and discard objects that are no longer needed by a program so that their resources can be reclaimed and reused.... Read more »

What is the difference between a constructor and a method? 

A constructor is a member function of a class that is used to create objects of that class. It has the same name as the class itself, has no return type, and is... Read more »

What is final? 

A final class can’t be extended ie., final class may not be subclassed. A final method can’t be overridden when its class is inherited. You can’t... Read more »

What is static in java? 

Static means one per class, not one for each object no matter how many instance of a class might exist. This means that you can use them without creating an instance... Read more »

What if the main method is declared as private? 

The program compiles properly but at runtime it will give “Main method not public.”... Read more »

What is the difference between HttpServlet and GenericServlet? 

A GenericServlet has a service() method aimed to handle requests. HttpServlet extends GenericServlet and adds support for doGet(), doPost(), doHead() methods (HTTP... Read more »

Page 2 of 16«12345»...Last »