Java Netbeans12 Scanner issue | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Java Netbeans12 Scanner issue

I am using java Netbeans 12 IDE, but when i run my code below, the program will ask the user to input first instead of (Enter your name is: ) is displayed, why is it happen and how to solve this problem? import.java.util.Scanner; public class Program { public static void main(String[] args) { //Declare Scanner object Scanner input = new Scanner(System.in); System.out.print("Enter your name: "); String name = input.nextLine(); System.out.printf("Your name is %s", name); } }

22nd Jan 2022, 2:27 AM
Jacky
1 Answer
+ 1
There is a bug filed for this here: https://issues.apache.org/jira/browse/NETBEANS-4453 A workaround seems to be to use the Ant build tool instead of Maven or Gradle (depending on which one you use).
22nd Jan 2022, 4:00 AM
Ani Jona 🕊
Ani Jona 🕊 - avatar