Subscribe

RSS Feed (xml)

Powered By

Skin Design:
Free Blogger Skins

Powered by Blogger


Sunday 31 August 2008

Java Interview Questions and Answers 33

How to make a class or a bean serializable?
By implementing either the java.io.Serializable interface, or the java.io.Externalizable interface. As long as one class in a class's inheritance hierarchy implements Serializable or Externalizable, that class is serializable.

What restrictions are placed on method overloading?
Two methods may not have the same name and argument list but different return types.

Name Container classes.
Window, Frame, Dialog, FileDialog, Panel, Applet, or ScrollPane

What is the List interface?
The List interface provides support for ordered collections of objects.

What is the difference between a Scrollbar and a ScrollPane?
A Scrollbar is a Component, but not a Container. A ScrollPane is a Container. A ScrollPane handles its own events and performs its own scrolling.

What is tunnelling?
Tunnelling is a route to somewhere. For example, RMI tunnelling is a way to make RMI application get through firewall. In CS world, tunnelling means a way to transfer data.

What is meant by "Abstract Interface"?
First, an interface is abstract. That means you cannot have any implementation in an interface. All the methods declared in an interface are abstract methods or signatures of the methods.

Can Java code be compiled to machine dependent executable file?
Yes. There are many tools out there. If you did so, the generated exe file would be run in the specific platform, not cross-platform.

Do not use the String contatenation operator in lengthy loops or other places where performance could suffer. Is that true?
Yes.

What method is used to specify a container's layout?
The setLayout() method is used to specify a container's layout.

Which containers use a FlowLayout as their default layout?
The Panel and Applet classes use the FlowLayout as their default layout.

What state does a thread enter when it terminates its processing?
When a thread terminates its processing, it enters the dead state.

What is the Collections API?
The Collections API is a set of classes and interfaces that support operations on collections of objects.

What is the List interface?
The List interface provides support for ordered collections of objects.

Is sizeof a keyword?
The sizeof operator is not a keyword in Java.

Which class is the superclass for every class.
Object.

Which Container method is used to cause a container to be laid out and redisplayed?
validate()

What's the difference between a queue and a stack?
Stacks works by last-in-first-out rule (LIFO), while queues use the FIFO rule

What comes to mind when you hear about a young generation in Java?
Garbage collection.

No comments:

Post a Comment