I\'m doing a project with basic Java for a CS class. The project has a for loop nested inside a while loop.
I am not allowed to use break as a wa
Also does it matter if 'return' doesn't return anything?
That depends on your method's return type. if the return type is void, a return clause must be empty:
return;
otherwise, a return clause must return the required type, e.g.
return true; // legal for boolean return type
return null; // legal for all object types
return "Hello"; // legal if return type is String