File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

long a = 0x1234ffffaaaabbbb ??

 
Pin Ting
Greenhorn
Posts: 22
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The primitive type long occupies 64 bits in Java, then why this statement doesn't compile
long a = 0x1234ffffaaaabbbb;
thanks all
 
Joel McNary
Bartender
Posts: 1824
Eclipse IDE Java Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It doesn't compile because the compiler thinks that the value is an int. You have to say:
long a = 0x1234ffffaaaabbbbL;
to force the compiler to recognize it as a long.
[ May 30, 2003: Message edited by: Joel McNary ]
 
Pin Ting
Greenhorn
Posts: 22
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot, Joel.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic