954,549 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

three boolean

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.

Sanna.1
Newbie Poster
7 posts since Feb 2012
Reputation Points: 10
Solved Threads: 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

DavidKroukamp
Practically a Master Poster
Team Colleague
693 posts since Dec 2011
Reputation Points: 282
Solved Threads: 169
 
JamesCherrill
Posting Genius
Moderator
6,373 posts since Apr 2008
Reputation Points: 2,130
Solved Threads: 1,073
 

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.

stultuske
Posting Sensei
3,137 posts since Jan 2007
Reputation Points: 1,114
Solved Threads: 433
 

Agreed. Let's keep further discussion in a single thread:
http://www.daniweb.com/software-development/java/threads/411255

Closing this one.

Ezzaral
Posting Genius
Moderator
15,986 posts since May 2007
Reputation Points: 3,250
Solved Threads: 847
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: