Question: What is the difference between a Window and a Frame?
Answer: The Frame class extends Window to define a main application window that can have a menu bar.
Question: Which class is extended by all other classes?
Answer: The Object class is extended by all other classes.
Question: Can an object be garbage collected while it is still reachable?
Answer: A reachable object cannot be garbage collected. Only unreachable objects may be garbage collected..
Question: Is the ternary operator written x : y ? z or x ? y : z ?
Answer: It is written x ? y : z.
Question: What is the difference between the Font and FontMetrics classes?
Answer: The FontMetrics class is used to define implementation-specific properties, such as ascent and descent, of a Font object.
Question: How is rounding performed under integer division?
Answer: The fractional part of the result is truncated. This is known as rounding toward zero.
Question: What happens when a thread cannot acquire a lock on an object?
Answer: If a thread attempts to execute a synchronized method or synchronized statement and is unable to acquire an object's lock, it enters the waiting state until the lock becomes available.
Question: What is the difference between the Reader/Writer class hierarchy and the InputStream/OutputStream class hierarchy?
Answer: The Reader/Writer class hierarchy is character-oriented, and the InputStream/OutputStream class hierarchy is byte-oriented.
Question: What classes of exceptions may be caught by a catch clause?
Answer: A catch clause can catch any exception that may be assigned to the Throwable type. This includes the Error and Exception types.
Question: If a class is declared without any access modifiers, where may the class be accessed?
Answer: A class that is declared without any access modifiers is said to have package access. This means that the class can only be accessed by other classes and interfaces that are defined within the same package.
Question: What is the SimpleTimeZone class?
Answer: The SimpleTimeZone class provides support for a Gregorian calendar.
Question: What is the Map interface?
Answer: The Map interface replaces the JDK 1.1 Dictionary class and is used associate keys with values.
Question: Does a class inherit the constructors of its superclass?
Answer: A class does not inherit constructors from any of its superclasses.
Question: For which statements does it make sense to use a label?
Answer: The only statements for which it makes sense to use a label are those statements that can enclose a break or continue statement.
Question: What is the purpose of the System class?
Answer: The purpose of the System class is to provide access to system resources.
Question: Which TextComponent method is used to set a TextComponent to the read-only state?
Question: How are the elements of a CardLayout organized?
Answer: The elements of a CardLayout are stacked, one on top of the other, like a deck of cards.
If you enjoyed this post then why not add us on Google+? Add us to your Circles
Liked it! Share this Tutorial
Ask Questions? Discuss: Core Java Interview Question, Interview Question
Post your Comment