Paste in Run box: Doesnt insert enter

Answered

I am trying to do old Google Kick Start rounds to try to get better at Java.

I recently switched from Eclipse to IntelliJ and I really like it.

But when I use java Scanner and paste something it automatically runs it without enter. Screenshot:

This is a problem because it should print 3 case's (works in eclipse). I am pretty sure it is because it doesn't insert an enter when I paste.

Is there a way to solve this?

Thanks for helping!

0
3 comments

Could you please provide a demo project to reproduce a problem?

1
Avatar
Permanently deleted user

@... Thanks for your comment! Demo project:

public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int a = scanner.nextInt();
int b = scanner.nextInt();
System.out.println(a);
System.out.println(b);
}

Demo paste:

3
4\n

0

Hello, could you please clarify what is the expected behavior here? Do you expect enter to be inserted automatically after you paste 3 \n 4?

0

Please sign in to leave a comment.