-
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