-
DataType Byte Values
What are the byte values of datatypes?
-
Inherit Private/Protected Class
Can a private/protected class be inherited? Explain
-
Read Input at Run Time
What are the different ways to read input from keyboard at run time?
-
What restrictions are placed on the values of each case of a switch statement
During compilation, the values of each case of a switch statement must evaluate to avalue that can bepromoted to an int value.
-
What is the difference between the paint() and repaint() methods
The paint() method supports painting via a Graphics object. The repaint() method is usedto cause paint() tobe invoked by the AWT painting thread.
-
What method must be implemented by all threads
All tasks must implement the run() method, whether they are a subclass of Thread orimplement theRunnable interface.
-
What is the difference between a public and a non-public class
A public class may be accessed outside of its package. A non-public class may not beaccessed outside ofits package.
-
What an I/O filter
An I/O filter is an object that reads from one stream and writes to another, usuallyaltering the data in someway as it is passed from one stream to another.
-
When is the finally clause of a try-catch-finally statement executed
The finally clause of the try-catch-finally statement is always executed unless the threadof executionterminates or an exception occurs within the execution of the finally clause.
-
What is the relationship between a method's throws clause and the exceptionsthat can bethrown during the method's execution
A method's throws clause must declare any checked exceptions that are not caught withinthe body of themethod.
-
What is the Collection interface
The Collection interface provides support for the implementation of a mathematical bag -an unorderedcollection of objects that may contain duplicates.
-
What is the relationship between clipping and repainting
When a window is repainted by the AWT painting thread, it sets the clipping regions tothe area of thewindow that requires repainting.
-
Q: Why are Java ARchive (JAR) files important?
JAR files bundle .class files and optimize applet downloads.
-
What happens when a thread cannot acquire a lock on an object
If a thread attempts to execute a synchronized method or synchronized statement and isunable to acquirean object's lock, it enters the waiting state until the lock becomes available.
-
What is the difference between a Window and a Frame
The Frame class extends Window to define a main application window that can have amenu bar.
-
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 event. TheenableEvents() method is used by objects that handle events by overriding their eventdispatchmethods.
-
What is the catch or declare rule for method declarations
If a checked exception may be thrown within the body of a method, the method musteither catch theexception or declare it in its throws clause.
-
Does garbage collection guarantee that a program will not run out of memory
Garbage collection does not guarantee that a program will not run out of memory. It ispossible forprograms to use up memory resources faster than they are garbage collected. It is alsopossible forprograms to create objects that are not subject to garbage collection
-
If a method is declared as protected, where may the method be accessed
A protected method may only be accessed by classes or interfaces of the same package orby subclasses ofthe class in which it is declared.
-
How is rounding performed under integer division
The fractional part of the result is truncated. This is known as rounding toward zero.
Java Interview Questions
Ans