hello
how do you get three strings in to a boolean.
Number 1 is greater than the number 2, which in turn is greater than third Number 1 is greater than one of the numbers 2 and 3, but not greater than both Number 1 is greater than at least one of the numbers 2 and 3.
did you mean how to check 3 numbers and still return true or false? check this maybe
int n1 = 3, n2 = 2, n3 = 4;
if (n1 > n2 && n1 > n3) {
System.out.println("Number 1 is greater than the number 2, which in turn is greater than third");
}
if ((n1 > n2) || (n1 > n3)) {
System.out.println("Number 1 is greater than at least one of the numbers 2 and 3");
}
if ((n1 > n2 || n1 > n3) && (n1 < n2 || n1 < n3)) {
System.out.println("Number 1 is greater than one of the numbers 2 and 3, but not greater than both");
} we use the and or operators and the less then and greater then.. &&, ||,<,> and combine it into an if statement to check the condition and return true or false
DavidKroukamp
Practically a Master Poster
Team Colleague
693 posts since Dec 2011
Reputation Points: 282
Solved Threads: 169