Core Java Flashcards
(93 cards)
If a variable is declared as private, where may thevariable be accessed?
A private variable may only be accessed within the class in which it is declared.
What is an object’s lock and which object’s havelocks?
An object’s lock is a mechanism that is used by multiple threads to obtain synchronized access to the object. A thread may execute a synchronized method of an object only after it has acquired the object’s lock. All objects and classes have locks. A class’s lock is acquired on the class’s Class object.
What is the Dictionary Class?
The Dictionary class provides the capability to store key-value pairs.
How are the elements of a BorderLayout organized?
NEWS Centre
What is the % operator?
Modulous division
When can an object reference be cast to an interfacereference?
When the object implements the instance to be referenced
What is the difference between a Window and aFrame?
The Frame class extends Window to define a main application window that can have a menu bar.
Which class is extended by all other classes?
The Object class is extended by all other classes.
Can an object be garbage collected while it is stillreachable?
No only while unreachable
Is the ternary operator written x : y ? z or x ? y : z ?
X?y:z
What is the difference between the Font andFontMetrics classes?
The FontMetrics class is used to define implementation-specific properties, such as ascent and descent, of a Font object.
How is rounding performed under integer division?
The fractional part of the result is truncated.
What happens when a thread cannot acquire a lockon an object?
enters waiting state
What is the difference between the Reader/Writerclass hierarchy and the InputStream/OutputStream classhierarchy?
The Reader/Writer class hierarchy is character-oriented, and the InputStream/ OutputStream class hierarchy is byte-oriented.
What classes of exceptions may be caught by a catchclause?
A catch clause can catch any exception that may be assigned to the Throwable type.
If a class is declared without any access modifiers,where may the class be accessed?
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.
Q117. What is the SimpleTimeZone class?
The SimpleTimeZone class provides support for a Gregorian calendar.
What is the Map interface?
The Map interface replaces the JDK 1.1 Dictionary class and is used associate keys with values.
Does a class inherit the constructors of itssuperclass?
nope
For which statements does it make sense to use alabel?
statements that can enclose a break or continue statement.
What is the purpose of the System class?
access to system resources
Which TextComponent method is used to set aTextComponent to the read-only state?
setEditable()
How are the elements of a CardLayout organized?
The elements of a CardLayout are stacked, one on top of the other, like a deck of cards.
Is &&= a valid Java operator?
nope