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);elsereturn; }
查看答案
You may have a return statement in a void method.
A. true
B. false
A _____ method does not return a value.
A. void
B. non-void
You must have a return statement in a non-void method.
A. false
B. true
A call for the method with a void return type is always a statement itself, but a call for the method with a non-void return type can be treated as either a statement or an expression.
A. false
B. true