I am having trouble with passing some variables through a method and then having that method return a value. The checkValue method is supposed to look at each of the array items in the orderSplit array and if there is an error with them, return an error message, if not it will return an empty errorMessage. But as of right now the program doesn't seem to be executing the method at all. Any suggestions?
Here is an example of my code:
public class Foo {
public static void main(String args[]) {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String order = null;
try {
order = br.readLine();
} catch (IOException exc) {
System.out.println("ERROR: A Problem has occured");
}
String[] orderSplit = null;
orderSplit = order.split(" ");
String errorMessage = "";
checkValue(orderSplit, errorMessage);
if (errorMessage == "") {
System.out.println("SUCCESS");
}
}
public static String checkValue(String[] orderSplit, String errorMessage) {
// check the ordersplit values
return errorMessage;
}
}