title: What is java.lang.NumberFormatException: null error?
body: <p>I tried using scanner class as well but I am still getting this error.Its still not able to read any input and still giving null exception i dont know why.</p>
  <pre><code>Exception in thread &quot;main&quot; java.util.NoSuchElementException
      at java.util.Scanner.throwFor(Scanner.java:862)
      at java.util.Scanner.next(Scanner.java:1485)
      at java.util.Scanner.nextInt(Scanner.java:2117)
      at java.util.Scanner.nextInt(Scanner.java:2076)
      at test.main(test.java:46)
  </code></pre>
  <p>This is the Code that I am trying to run : <a href="https://www.codechef.com/FEB221C/problems/DIGMULK" rel="nofollow noreferrer">https://www.codechef.com/FEB221C/problems/DIGMULK</a></p>
  <pre><code>import java.util.Scanner;
  public class test{
      static void game(String s,int n,int k,int m)
      {
          String g=&quot;&quot;;
          if(s!=&quot;0&quot;)
          {
              for(int i=0;i&lt;m;i++)
              {
                  int d;
                  
                  for(int j=0;j&lt;s.length();j++)
                  {
                      char a=s.charAt(j);
                      d=(int)a-48;
                      
                      if(d==0)
                      continue;
                      
                      d=d*k;
                      String b=Integer.toString(d);
                      g=g+b;
                  }
                  s=g;
                  g=&quot;&quot;;
              }
              System.out.print(s.length());
              System.out.println();
          }
          else
          {
              System.out.print(&quot;1&quot;);
              System.out.println();
          }
        }
      
      public static void main(String[] args)
      {
          Scanner sc = new Scanner (System.in);
          int t,n,k,m;
          String s;
          t=sc.nextInt();
          while(t&gt;0)
          {
              n=sc.nextInt();
              k=sc.nextInt();
              m=sc.nextInt();
              s=sc.nextLine();
              test.game(s,n,k,m);
              t--;
          }
      } 
  }
  </code></pre>