1

I am using Eclipse to run my java programs but there is a problem with Eclipse's console that the input and output appears in the same console. For example

public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int t = scan.nextInt();
        while(t-- > 0) {
            int n = scan.nextInt();
            System.out.println(n);
        }
        scan.close();
    }

For this code let the input be

2
3
4

then the output that i gets looks like

2
3
43

4

Is there any way to get separate input and output and get the distinction in eclipse.

1 Answers1

1

One could re-assign System.in and/or System.out as discussed here.

Of course, this is not Eclipse-specific solution but a Java one.

I would be working with files in first place.

Michal
  • 2,353
  • 1
  • 15
  • 18