title: I am getting this error in my java code Exception in thread "main" java.util.NoSuchElementException
body: <pre><code>import java.util.Scanner;
  
  public class RotateBy90Degree {
      public static void main(String[] args) {
          Scanner s = new Scanner(System.in);
          int n = s.nextInt();
          int m = s.nextInt();
          int[][] arr = new int[n][m];
          for (int i = 0; i &lt; n; i++) {
              for (int j = 0; j &lt; m; j++) {
                  arr[i][j] = s.nextInt();
              }
          }
          int[][] arr1 = new int[m][n];
          s.close();
          int row=0, col=n-1;
          for(int i=0;i&lt;m;i++){
              for(int j=0;j&lt;n;j++){
                  if(row&gt;=0 &amp;&amp; col&gt;=0){
                      arr1[row][col]=arr[j][i];
                  }
                  if(col&lt;=0){
                      row++;
                      col=n-1;
                  } else {
                      col--;
                  }
              }
          }
          for(int i=0;i&lt;m;i++){
              for(int j=0;j&lt;n;j++){
                  System.out.print(arr1[i][j]+&quot; &quot;);
              }
              System.out.println();
          }  
      }
  }
  </code></pre>
  <p>This is Java Code I don't know why when I am running this on VScode I am not getting any error, my output is perfectly good but If I run this code on a website called &quot;pepcoding&quot; it showing me this error like this</p>
  <p>Exception in thread &quot;main&quot; java.util.NoSuchElementException</p>
  <pre><code>at java.base/java.util.Scanner.throwFor(Scanner.java:937)
  
  at java.base/java.util.Scanner.next(Scanner.java:1594)
  
  at java.base/java.util.Scanner.nextInt(Scanner.java:2258)
  
  at java.base/java.util.Scanner.nextInt(Scanner.java:2212)
  
  at Main.main(Main.java:11)
  </code></pre>
  <p>can somebody confirm that it is my error in the program or the website is not correct</p>