This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 269466

Summary: Problem with Scanner class, println and output window
Product: java Reporter: curro
Component: CompilerAssignee: Dusan Balek <dbalek>
Status: NEW ---    
Severity: normal    
Priority: P3    
Version: 8.2   
Hardware: PC   
OS: Linux   
Issue Type: DEFECT Exception Reporter:

Description curro 2016-12-31 09:31:23 UTC
When I use a Scanner to read input from user several times, there is a problem with the next print line. With this simple code:

                Scanner sc = new Scanner (;
                System.out.println("Introduce first number");
                int number1 = sc.nextInt();
                System.out.println("Introduce second number");
                int number2 = sc.nextInt();

When I run it, appears the first string and wait:

Introduce the first number

If I enter 12 for example and press enter, then appears the second string and then my input number and las wait for the second number:

Introduce first number
Introduce second number

It only happen in Linux (not in MacOS nor Windows). I use Linux Mint distribution. 
I think that is a synchronization thread problem because if I put a Thread.sleep before the first nextInt() all works fine.