Does the return statement in the following method cause compile errors?

public static void main(String[] args) {
int max = 0;
if (max != 0)
System.out.println(max);
else
return;
}
a. Yes
b. No


b It is rare, but sometimes useful to have a return statement for circumventing the normal flow of control in a void method.

Computer Science & Information Technology

You might also like to view...

Each Office app has its own Help home page.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

A MouseHandler object implements which two interfaces?

a. MouseListener and MouseActionListener. b. MouseListener and MouseMotionListener. c. MouseListener and MouseEventListener. d. MouseListener only.

Computer Science & Information Technology

The addition of indexes to a database can speed up retrieval yet at the same time slow down the rate at which data is updated.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

A __________ language allows the programmer to create very powerful and complex programs without knowing how the CPU works.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology