For Sorted Array in challanges for recursion

import java.util.Scanner;

public class sortedArray {

public static void main(String[] args) {
	 Scanner s = new Scanner(System.in);
      System.out.println("Enter the length of the array:");
      int length = s.nextInt();
      int [] arr = new int[length];
      System.out.println("Enter the elements of the array:");

      for(int i=0; i<length; i++ ) {
         arr[i] = s.nextInt();
      }

System.out.println(sortedArray(arr,0));

}

public static boolean sortedArray(int[] arr,int start) {
	if(arr.length-1==start) {
		return true;
	}
	
	int index=0;
	
	if(arr[start]>arr[start+1])
	return false;
	return sortedArray(arr,start+1);

getting exception
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 sortedArray.main(sortedArray.java:8)

Hi Gaurav,
Delete the print statements you have used before taking the input.

Hi Gaurav
As you are not responding to this thread, I am marking your doubt as Resolved for now. Re-open it if required.
Please mark your doubts as resolved in your course’s “ Ask Doubt ” section, when your doubt is resolved.