# refresh help

• 02-17-2011, 08:51 AM
silverspoon34
refresh help
Hi all

doing second year of degree this is not for an assignment but refreshing and cant remember how to change something so please can someone remind me.

I am doing a basic program finding the highest number and lowest number out of user inputs so below is a line point where i cant emember where to go.

Code:

`if(num1 <num2 || num1 <num3)`
Then i want to say that if num 1 is less than num2 and num3 then num1 = XX but then is not an operator and my mind is blank

• 02-17-2011, 09:23 AM
JosAH
Quote:

Originally Posted by silverspoon34
Hi all

doing second year of degree this is not for an assignment but refreshing and cant remember how to change something so please can someone remind me.

I am doing a basic program finding the highest number and lowest number out of user inputs so below is a line point where i cant emember where to go.

Code:

`if(num1 <num2 || num1 <num3)`
Then i want to say that if num 1 is less than num2 and num3 then num1 = XX but then is not an operator and my mind is blank

Strange: in your text you write "if num1 is less than num2 and num3 ..." but in your code your write ïf num1 is less than num2 or num1 is less than num3". w.r.t. your question: Java (nor C nor C++) have a 'then' keyword; the syntax simply is:

Code:

`if (<condition>) statement;`
Note that a block statement { ... } is also a statement so you can put this:

Code:

```if (<condition>) {   // bunch of statements here }```
kind regards,

Jos
• 02-17-2011, 09:39 AM
silverspoon34
refresh
ok but how do I then get the program to put the result from num1 into intxx as I have to do this program over 3 integers entered so xx could change and at the end of program highest (XX) and lowest(YY) will be printed

suppose i could use 2 empty arrays but i still need num1,2 or 3 which ever is greatest to end up in XX
• 02-17-2011, 10:24 AM
silverspoon34
refresh
all come back to me with a slight prodding thanks
• 02-17-2011, 11:29 AM
JosAH
Quote:

Originally Posted by silverspoon34
ok but how do I then get the program to put the result from num1 into intxx as I have to do this program over 3 integers entered so xx could change and at the end of program highest (XX) and lowest(YY) will be printed

suppose i could use 2 empty arrays but i still need num1,2 or 3 which ever is greatest to end up in XX

Simply stick all your numbers in array and use a method from the Arrays utility class (read its API documentation) to sort those numbers; the first one is the lowest one and the last one is the highest number after sorting.

kind regards,

Jos
• 03-28-2011, 12:49 PM
deepthycimat
<moderator edit: hijack post deleted>
• 03-29-2011, 02:03 AM
Fubarable