wood burning stoves
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
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: 453

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: 808

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.
I agree. Here's the link: http://aspose.com/file-tools
subject: < operator
jQuery in Action, 3rd edition