wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes < operator Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "< operator" Watch "< operator" New topic

< operator

vineet walia
Ranch Hand

Joined: Feb 16, 2008
Posts: 138

1st syso statement give error which is
The operator < is undefined for the argument type(s) String, int

but if < operator can not be operate on int then why 1st syso statement is executing ??
avi sinha
Ranch Hand

Joined: Mar 15, 2009
Posts: 452

the reason here is the "string" before the digits you want to compare.

and you can't compare a string with a number. you should write "direct output"+(5<6) it will work for sure.

avi sinha

SCJP 5.0 SCWCD 5.0
Lucas Smith
Ranch Hand

Joined: Apr 20, 2009
Posts: 804

It's only operator precedence.

BLOG: http://leakfromjavaheap.blogspot.com
S Bhanage

Joined: Oct 28, 2009
Posts: 13
Use the following

System.out.println("direct output"+(5<6));

It works fine.
jQuery in Action, 2nd edition
subject: < operator
Similar Threads
How to set value in jtable fields??
Simple precedence question.
LinkedHashMap - trying to use the method removeEldestEntry
Want to convert my code in method
please explain its output