|
|
|
Java Interview Questions - Set 3
1. What is a native method? A native method is a method that is implemented in a language other than Java. For example, one method may be written in C and can be called in Java.
2. How can you write a loop indefinitely? for(;;) //for loop while(true); //always true
3. 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.
4. 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. For example, closing a opened file, closing a opened database Connection.
5. What invokes a thread’s run() method? After a thread is started, via its start() method or that of the Thread class, the JVM invokes the thread’s run() method when the thread is initially executed.
6. What is the GregorianCalendar class? The GregorianCalendar provides support for traditional Western calendars.
7. What is the SimpleTimeZone class? The SimpleTimeZone class provides support for a Gregorian calendar.
8. 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.
9. What is the purpose of the Runtime class? The purpose of the Runtime class is to provide access to the Java runtime system.
10. What is the purpose of the System class? The purpose of the System class is to provide access to system resources.
|
No responses found. Be the first to respond and make money from revenue sharing program.
|