| 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.
|
 |
 |
|
|
subject: How to use "toHexString"?
|
|
|