Hello everyone I’m trying to improve my Java skills by solving some problems from ACM, now the thing is my sample input looks like this :
3 100
34 100
75 250
27 2147483647
101 304
101 303
-1 -1
So at first I’m just trying to read them but its not working here is the java code:
import java.io.BufferedInputStream;
import java.util.Scanner;
public class Main {
public static void main(String args[]) {
Scanner stdin = new Scanner(new BufferedInputStream(System.in));
while (stdin.hasNext()) {
System.out.println(stdin.nextInt() + " and the next " + stdin.nextInt());
}
}
}
I’m trying to send these inputs as an argument, and not by reading them from file, here is how:
The program just spins(executes) but not printing anything. How can I fix this?

The arguments you have specified in your wizard are not input to the program via std in. Instead, they are passed in in the
String[] argsarguments passed into yourmainmethod. As it looks as though you are running in Eclipse, you can go to the Console tab that gets generated and type into that window. Alternatively, you can iterate over theargsparam to get those values.