• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to use "toHexString"?

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Sheriff
Posts: 11343
Mac Safari Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
lauren bai
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,Marc, you are so right. I even didn't notice that.
I study 1.5 API but run on 1.4.
reply
    Bookmark Topic Watch Topic
  • New Topic