In C i do this:
int main(){
int N = 0;
while(scanf("%d",&N) != EOF){ // <--- how to do this condition in java?
... Code ...
}
My input is some numbers: 10 20 5 9 7 6... and when i hit enter my output is some matrix.
I know there is another topic, here, similar to this, but not solve my problem.
Any suggestion?
My problem is solved by Elliot, i just do this:
import java.io.IOException;
import java.util.Scanner;
public class Main {
public static void main(String[] args) throws IOException {
int N = 0;
@SuppressWarnings("resource")
Scanner scanner = new Scanner(System.in);
while(scanner.hasNextLine()){
N = (int) scanner.nextDouble();
... code ...
}
}
Working fine.