Win a copy of Murach's Python Programming this week in the Jython/Python forum!
    Bookmark Topic Watch Topic
  • New Topic

Assinging Compile time long constant to byte fails  RSS feed

 
Harish Kommaraju
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi,

I am aware that if you are assigning int to a byte without any implicit cast, then the int should be a compile time constant.
i.e. the below code compile fines.


But if I try the same thing with long, it fails.


Why is that compile time constant of type int can be assigned to byte without any implicit cast, but we cannot assign compile time long to byte?

Thanks,
Harish
 
Rob Spoor
Sheriff
Posts: 20893
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please use one thread per question. Since you've already had one reply here that is where we shall continue.
 
It is sorta covered in the JavaRanch Style Guide.
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!