Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
12.2
-
None
Description
This code due to I got this Error:
Exception in thread "main" java.util.NoSuchElementException: No line foundException in thread "main" java.util.NoSuchElementException: No line found at java.base/java.util.Scanner.nextLine(Scanner.java:1651)
This is my code:
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package sigma; import java.util.Scanner; /** * * @author sigma */ public class Main { /** * @param args the command line arguments */ public static void main(String[] args) { System.out.println("What is your name : "); Scanner scanner = new Scanner(System.in); String name = scanner.nextLine().trim(); System.out.println("My name is " + name); } }