error message help

i have met a problem.a really simply program, which require user to enter 5 integers, and output the largest one and the smallest one by using IF statement,

I have created a statement like"

if(num1<num2><num3><num4><num5)

result=result +num1+"is the smallest number";

however when i compile it. it give me the error message shows below

operator >< cannot be applied to boolean,int

if(num1<num2><num3><num4><num5)

^

operator >< cannot be applied to boolean,int

if(num1<num2><num3><num4><num5)

^

I am only want to use the IF statement, nothing else. , so please help!

thx

Message was edited by:

ritchie_lin

Message was edited by:

ritchie_lin>

[828 byte] By [ritchie_lina] at [2007-11-27 10:27:09]
# 1

repost but put spaces between your greater than, less than symbols and your variables. The forum software messes up your posts if there are no spaces.

petes1234a at 2007-7-28 17:43:47 > top of Java-index,Java Essentials,New To Java...
# 2

also, you cannot "chain" these operators. In other words, you can't do:

if (a > b > c > d) // won't work!

instead you must do:

if (a > b && b > c && c > d) // should work!

petes1234a at 2007-7-28 17:43:47 > top of Java-index,Java Essentials,New To Java...
# 3

Hint: you can't use informal idioms like this in most programming languages, and that includes Java:

if (a < b < c) //wrong

if (a < b && b < c) //right

I suggest you learn the syntax:

http://java.sun.com/docs/books/tutorial/java/index.html

edit -- punchbug!

Message was edited by:

BigDaddyLoveHandles

BigDaddyLoveHandlesa at 2007-7-28 17:43:47 > top of Java-index,Java Essentials,New To Java...
# 4

no punch back!

petes1234a at 2007-7-28 17:43:47 > top of Java-index,Java Essentials,New To Java...
# 5

THANK you soooooooooo much, really great help

Message was edited by:

ritchie_lin

ritchie_lina at 2007-7-28 17:43:47 > top of Java-index,Java Essentials,New To Java...