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

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

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Open
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 12.2
    • Fix Version/s: None
    • Component/s: projects - Gradle
    • Labels:

      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

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

              Dates

              • Due:
                Created:
                Updated: