Friday, September 19, 2008

How many methods in Object class? -JAVA Interview Questions and Answers

Name Component subclasses that support painting ?
The Canvas, Frame, Panel, and Applet classes support painting.

What is a native method?
A native method is a method that is implemented in a language other than Java.

How can you write a loop indefinitely?
for(;;)--for loop; while(true)--always true, etc.

Can an anonymous class be declared as implementing an interface and extending a class?
An anonymous class may implement an interface or extend a superclass, but may not be declared to do both.

What is the purpose of finalization?
The purpose of finalization is to give an unreachable object the opportunity to perform any cleanup processing before the object is garbage collected.

When should the method invokeLater()be used?
This method is used to ensure that Swing components are updated through the event-dispatching thread.

How many methods in Object class?
This question is not asked to test your memory. It tests you how well you know Java. Ten in total.
clone()
equals() & hashcode()
getClass()
finalize()
wait() & notify()
toString()

How does Java handle integer overflows and underflows?
It uses low order bytes of the result that can fit into the size of the type allowed by the operation.


Is the numeric promotion available in other platform?
Yes. Because Java is implemented using a platform-independent virtual machine, bitwise operations always yield the same result, even when run on machines that use radically different CPUs.


When is the ArithmeticException throwQuestion: What is the GregorianCalendar class?
The GregorianCalendar provides support for traditional Western calendars.

What is the SimpleTimeZone class?
The SimpleTimeZone class provides support for a Gregorian calendar.

How can a subclass call a method or a constructor defined in a superclass?
Use the following syntax: super.myMethod(); To call a constructor of the superclass, just write super(); in the first line of the subclass's constructor.

What is the Properties class?
The properties class is a subclass of Hashtable that can be read from or written to a stream. It also provides the capability to specify a set of default values to be used.

What is the purpose of the Runtime class?
The purpose of the Runtime class is to provide access to the Java runtime system.

No comments:

Post a Comment

Thanks to given comments.......

My Blog List