0

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.

5
Contributors
4
Replies
5
Views
5 Years
Discussion Span
Last Post by Ezzaral
Featured Replies
  • 1
    Ezzaral 2,714   5 Years Ago

    Agreed. Let's keep further discussion in a single thread: [url]http://www.daniweb.com/software-development/java/threads/411255[/url] Closing this one. Read More

0

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

Edited by DavidKroukamp: n/a

0

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.

as JamesCherrill said: stick to the original thread.
next to that: a String is not a numerical type, so your question does not make any sense.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.