title: When I execute my program the program displays java.util.NoSuchElementException: No line found
body: <p>I'm a bit new to java, and I am wondering what I did wrong in my code. The problem is at "System.out.println(pw.next());" This code is for a Pokemon like game, and the scanner is supposed to scan for the person's username. I am far from finished with the code, and the layout is a bit weird because I tried fixing the error myself.</p>
  
  <p>It would also be highly appreciated if anyone has tips for creating a fun game.</p>
  
  <pre><code>package test;
  import java.lang.Math;
  import java.util.*;
  
  public class Pokemon {
  
      public static void main(String[] args) {
          Scanner sc = new Scanner(System.in);
          System.out.println("Welcome to Daniel's Game");
          System.out.println("\nFire. Water. Earth. Air. The four nations lived in harmony until the Avatar attacked. \nFueled by anger, this avatar, whose name remains unknown, has sought to take over the world.\nLegends say that he lives deep in the Himalayas and wields the power of all four elements, but nobody can say for sure");
          System.out.println("It is your job to save the world from catastrophe");
          System.out.println("Are you up for the Challenge?");
          String y = sc.next();
          if(y.equals("yes")||y.equals("Yes")) {
              System.out.println("You better be");
          } else {
              System.out.println("The world ends cuz you suck");
              System.exit(0);
          }
          sc.close();
          name();
  
      }
      public static void name() {
          System.out.println("What is Your Name?");
          Scanner pw = new Scanner(System.in);
          String o = pw.next();
          pw.close();
          Scanner ew = new Scanner(System.in);
          System.out.println("\nChoose a Pokemon: \n1. Fire \n2. Water\n 3. Earth \n4. Air");
  
          int x = ew.nextInt();
  
          ew.close();
      }
  
  }
  </code></pre>