File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Range related 2 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 "Range related 2" Watch "Range related 2" New topic

Range related 2

achayya matta
Ranch Hand

Joined: Oct 27, 2005
Posts: 111
class JJF4 {
public static void main(String args[]) {


can anyone explain me how the above code is printing "ffff" when run?
using jdk 1.4.2_03
thanks in advance
Steve Morrow
Ranch Hand

Joined: May 22, 2003
Posts: 657

Are you familiar with hexadecimal representation of numbers? If not, there is a wealth of information available via Google. If you are familiar with it, what confusion do you have about the code?
Cheenu Subramanian
Ranch Hand

Joined: Aug 15, 2005
Posts: 40
As Steve said , get ur self acquainted with the hexadecimal representation.


Character.MAX_VALUE when represented as int is 65535 which is represented as ffff in hexadecimal
Tilo Hemp
Ranch Hand

Joined: Nov 21, 2005
Posts: 91
the missing "," is strange. I think, the ouptut should be "ffff,".
Mandy Hou

Joined: Oct 15, 2005
Posts: 21
char is unsigned prim
so the rang is 0-62235

Regards<br />Mandy<br /> <br />-----------------<br />Thinking,Thinking,Thinking,<br />Before you do any action!!!
I agree. Here's the link:
subject: Range related 2
It's not a secret anymore!