Uploaded image for project: 'NetBeans'
  1. NetBeans
  2. NETBEANS-5365

Exception in thread "main" java.util.NoSuchElementException: No line found

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 12.2
    • None
    • projects - Gradle

    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);
       
       }
       
       
      }
      

       

      Attachments

        Activity

          People

            lkishalmi Laszlo Kishalmi
            killercode Navid Taheri
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: