Originally Posted by
staykovmarin
Post your current code (also a partial exception is really of no help).
I have a feeling that InputInt is still static.
import java.util.Scanner;
class Input {
public int InputInt() {
int x = 0;
Scanner in = new Scanner(System.in);
// reads int from the console
// and stores into x
x = in.nextInt();
// notice that now you can close the stream, since the method is non static
in.close();
return x;
}
}
___________________
import java.util.Scanner;
class Input {
public int InputInt() {
int x = 0;
Scanner in = new Scanner(System.in);
// reads int from the console
// and stores into x
x = in.nextInt();
// notice that now you can close the stream, since the method is non static
in.close();
return x;
}
}
PS: how do you separate code from a message?
