Interview Questions

Java Back

To what value is a variable of the String type automatically initialized?

Ans:  The default value of an String type is null.

To what value is a variable of the String type automatically initialized?

Ans:  The default value of an String type is null.

When a thread blocks on I/O, what state does it enter?

Ans:  A thread enters the waiting state when it blocks on I/O.

What are order of precedence and associativity, and how are they used?

Ans:  Order of precedence determines the order in which operators are evaluated in expressions. Associatity determines whether an expression is evaluated left-to-right or right-to-left.

Can a for statement loop indefinitely?

Ans:  Yes, a for statement can loop indefinitely. For example, consider the following: for(;;).

What is a native method?

Ans:  A native method is a method that is implemented in a language other than Java.

What is clipping?

Ans:  Clipping is the process of confining paint operations to a limited area or shape.

What is the immediate superclass of the Dialog class?

Ans:  Window.

What value does readLine() return when it has reached the end of a file?

Ans:  The readLine() method returns null when it has reached the end of a file.

Name three Component subclasses that support painting.

Ans:  The Canvas, Frame, Panel, and Applet classes support painting.