Compilation Failed
Main.java:18: error: variable next might not have been initialized
if(next>x)
^
1 error
введите описание изображения здесь
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n,first,next,x,i=0,count=0;
n = sc.nextInt();
first = sc.nextInt();
for(i=0; i<n-1; i++){
next = sc.nextInt();
if(first<=next)
break;
}
for(int j=i+1; j<n-1; j++){
x = sc.nextInt();
if(next>x)
count = 1;
}
if(count==1)
System.out.print("false");
else
System.out.print("true");
}
}