Which two are permitted in the method body?

You are writing a method that is declared not to return a value.
Which two are permitted in the method body?

You are writing a method that is declared not to return a value.
Which two are permitted in the method body?

A.
omission of the return statement

B.
return null;

C.
return void;

D.
return;

Explanation:
Any method declared void doesn’t return a value. It does not need to contain a return statement, but it may do so. In such a case, a return statement can be used to branch out of a control flow block and exit the method and is simply used like this:
return;



Leave a Reply 2

Your email address will not be published. Required fields are marked *


Jazz

Jazz

A,D

A return statement can be used to branch out of a control flow block and exit the method and is simply used like this: return;

James

James

The Answer is A, D.