This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes How to use 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 "How to use "toHexString"?" Watch "How to use "toHexString"?" New topic
Author

How to use "toHexString"?

lauren bai
Greenhorn

Joined: Apr 08, 2005
Posts: 18
I create a class as follows:
class DoubletoHexString {

public static void main(String[] args) {

Double a = new Double(Double.NaN);

System.out.println("a: " + a.doubleValue());
System.out.println("doubletoHexString: " + Double.toHexString(a.doubleValue()));
}
}


I got compile error
DoubletoHexString.java:8: cannot resolve symbol
symbol : method toHexString (double)
location: class java.lang.Double
System.out.println("doubletoHexString: " + Double.toHexString(a.doubleValue()));


I check my spelling is correct. Can anybody tell why it's not correct?
[ April 14, 2005: Message edited by: lauren bai ]

SCJP (In Progress)
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

The code is correct. In Float and Double, the toHexString method is new with Java 1.5, so I'm guessing that you are using an earlier version compiler.


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
lauren bai
Greenhorn

Joined: Apr 08, 2005
Posts: 18
Hi,Marc, you are so right. I even didn't notice that.
I study 1.5 API but run on 1.4.
 
GeeCON Prague 2014
 
subject: How to use "toHexString"?