KyaPoocha.com

Huge Collection of Interview Questions


‘Java Interview Questions’ - KyaPoocha.com

What if the static modifier is removed from the signature of the main method? 

Program compiles. But at runtime throws an error “NoSuchMethodError”.  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.” message.  Read more »

What is a compilation unit? 

A compilation unit is a Java source code file.  Read more »

What is the purpose of garbage collection? 

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

How are this and super used? 

this is used to refer to the current object instance. super is used to refer to the variables and methods of the superclass of the current object instance.  Read more »

What interface must an object implement before it can be written to a stream as an object? 

An object must implement the Serializable or Externalizable interface before it can be written to a stream as an object.  Read more »

Which package is always imported by default? 

The java.lang package is always imported by default.  Read more »

What is your platform’s default character encoding? 

If you are running Java on English Windows platforms, it is probably Cp1252. If you are running Java on English Solaris platforms, it is most likely 8859_1..  Read more »

What happens when you add a double value to a String? 

The result is a String object.162.  Read more »

What is the difference between the File and RandomAccessFile classes? 

The File class encapsulates the files and directories of the local file system. The RandomAccessFile class provides the methods needed to directly access data contained... Read more »

What is the purpose of the enableEvents() method? 

The enableEvents() method is used to enable an event for a particular object. Normally, an event is enabled when a listener is added to an object for a particular... Read more »

What is a void return type? 

A void return type indicates that a method does not return a value.  Read more »

Are true and false keywords? 

The values true and false are not keywords.  Read more »

What are E and PI? 

E is the base of the natural logarithm and PI is mathematical value pi.  Read more »

What classes of exceptions may be thrown by a throw statement? 

A throw statement may throw any expression that may be assigned to the Throwable type.  Read more »

Page 4 of 33« First...«23456»...Last »