not accepting input by scanner.
public static void main(String args[]) {
// Your Code Here
Scanner sc = new Scanner(System.in);
int N;
N=sc.nextInt();
int l[] =new int[N];
for(int i=0;i<N; i++)
{
l[i]=sc.nextInt();
}
System.out.println(IsSorted(l,N));
}
error:
Exception in thread “main” 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 sort.main(sort.java:29)