wood burning stoves 2.0*
The moose likes Java in General and the fly likes operand types that can be compared Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "operand types that can be compared" Watch "operand types that can be compared" New topic
Author

operand types that can be compared

Tina Desai
Ranch Hand

Joined: Mar 13, 2003
Posts: 365
Hello,
I want a list of all the oeprand types that can be compared and would not give me a compile time error.
For this I tried checking the Java Language specs. I could see order of operantions, precedence etc. I wonder if such kind of information is available in specs. I feel it should be.
Anyone who has come across such information in the specs?
Thanks and Regards,
Leena


Alongwith being a good coder, try to be a good professional as well!
Peter den Haan
author
Ranch Hand

Joined: Apr 20, 2000
Posts: 3252
Compared -- using what? The '<' operator and friends? The JLS will tell you (all primitives except booleans, I think); the conversion rules will tell you exactly how the language handles mixed types. With compareTo()? Aything that is Comparable. This is something for the API specification rather than the language specification, and you can find a list of Comparable classes in the core API at the top of the javadoc page.
- Peter
[ June 27, 2003: Message edited by: Peter den Haan ]
Tina Desai
Ranch Hand

Joined: Mar 13, 2003
Posts: 365
May be I should make it more clear.
I am after wirting a condition parser.
If I have -
i and str, I have to decide whether they can be compared. can the spec help me in it?
Tina
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: operand types that can be compared
 
Similar Threads
== operator
mime-mapping in web.xml
Cleared WCD with 81%
Recommended books for SCMAD
coding for the PALM OS