File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes long a = 0x1234ffffaaaabbbb ?? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "long a = 0x1234ffffaaaabbbb ??" Watch "long a = 0x1234ffffaaaabbbb ??" New topic
Author

long a = 0x1234ffffaaaabbbb ??

Pin Ting
Greenhorn

Joined: May 28, 2003
Posts: 22
The primitive type long occupies 64 bits in Java, then why this statement doesn't compile
long a = 0x1234ffffaaaabbbb;
thanks all


Never do things the hard way if you don't have a good reason.
Joel McNary
Bartender

Joined: Aug 20, 2001
Posts: 1817

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 ]

Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
Pin Ting
Greenhorn

Joined: May 28, 2003
Posts: 22
Thanks a lot, Joel.
 
Consider Paul's rocket mass heater.
 
subject: long a = 0x1234ffffaaaabbbb ??
 
Similar Threads
converting int to long
byte and short
byte
integer literals
Passed IBM 158