Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java's L number (long)

 
Elier Rguez
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
can anybody see why l1 compile well and don't l2?


Thanks in advance,




 
Henry Wong
author
Marshal
Pie
Posts: 21498
84
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Elier Rguez wrote:
can anybody see why l1 compile well and don't l2?




Only certain conversions are allowed by the Java Language Specifications -- and an implicit widening cast from int to long, followed by an autobox from long to Long, isn't one of the allowed conversions.


See .. http://docs.oracle.com/javase/specs/jls/se7/html/jls-5.html#jls-5.2

Henry
 
Elier Rguez
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Got it, thanks.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic