If an array is defined inside of a method, it can be passed as an arg to another method that is called from that method:
void aMethod() {
int[] anArray = {1}; // define an array in this...
Type: Posts; User: Norm
If an array is defined inside of a method, it can be passed as an arg to another method that is called from that method:
void aMethod() {
int[] anArray = {1}; // define an array in this...
Sorry I don't understand your question.
An array can hold many values.
What do you want the method to do?
The code still has the recursive call. That should be removed and a loop used instead.
That is probably because of the recursive call:
studentNumberEntered(number, sc);
Use a loop instead of a recursive call.
Put the code in a while() loop that continues looping UNTIL the user enters the desired input.
Put the code that causes the exception inside a try{}catch block. The catch block code will get control if an exception is thrown.
I don't know any way to stop a user from entering whatever he wants. The program can refuse to accept what is entered and ask the user to enter what the program wants. This can be done repeatedly...