Hey I'm trying to call a string from my server class to check if the numbers of an array in my client are in order but i'm having difficulties getting the value of the return of the string in my class here's what I have so far...
import java.util.Scanner;
public class Main {
public static void main(String[] args){
System.out.println("Insert 10 numbers in order from least to greatest");
Scanner input = new Scanner(System.in);
int[] array = new int[10];
for(int i=0; i<array.length; i++){
int x = input.nextInt();
}
}
}
Client Above ^^^^
Server Below VVVV
public class Server {
public String checkFalse(int[] array){
String checker = "Error, the numbers are not in order";
int number = 0;
for(int i =0; i<array.length-1; i++){
number = array[i];
if(array[i+1] < number){
return checker;
}
}
return null;
}
}
"number" in the server is merely a placeholder of the value at the index "i" to see if the value at the next index is less than that number at i
so basically how would I get the return of checkFalse in the server class? Any help is appreciated thanks! (Also first question so don't kill me for errors in typing question etc)