-
When a thread is created and started, what is its initial state
A thread is in the ready state after it has been created and started.
-
What is the argument type of a program's main() method
A program's main() method takes an argument of the String[] type.
-
What is the purpose of the wait(), notify(), and notifyAll() methods
The wait(),notify(), and notifyAll() methods are used to provide an efficient way forthreads to wait for a shared resource. When a thread executes an object's wait() method, itenters the waiting state. It only enters the ready state after another thread invokes theobject's notify() or notifyAll() methods..
-
What modifiers may be used with an interface declaration
An interface may be declared as public or abstract.
-
What is the difference between a while statement and a do statement
A while statement checks at the beginning of a loop to see whether the next loop iterationshould occur. A do statement checks at the end of a loop to see whether the next iterationof a loop should occur. The do statement will always execute the body of a loop at leastonce.
-
When does the compiler supply a default constructor for a class
The compiler supplies a default constructor for a class if no other constructors areprovided.
-
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 of the class in which it is declared.
-
What is the return type of a program's main() method
A program's main() method has a void return type.
-
How is it possible for two String objects with identical values not to be equalunder the == operator
The == operator compares two objects to determine if they are the same object inmemory. It is possible for two String objects to have the same value, but locatedindifferent areas of memory.
-
What are the legal operands of the instanceof operator
The left operand is an object reference or null value and the right operand is a class,interface, or array type.
-
Are true and false keywords
The values true and false are not keywords.
-
What happens when you add a double value to a String
The result is a String object.
-
How can a dead thread be restarted
A dead thread cannot be restarted.
-
-
-
-
-
-
-
Java Interview Questions
Ans