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
  • Any reaction regarding my answer? Commented Apr 21, 2022 at 12:19

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.