Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

long a = 0x1234ffffaaaabbbb ??

 
Pin Ting
Greenhorn
Posts: 22
  • 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: 1840
Eclipse IDE Java Ruby
  • 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
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot, Joel.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic