Akhil-Sharma02
Akhil-Sharma02

Reputation: 93

Separate Input And Output In Console In Eclipse

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.

Upvotes: 1

Views: 127

Answers (1)

Michal
Michal

Reputation: 2423

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.

Upvotes: 1

Related Questions