This week's book giveaway is in the JavaFX forum.
We're giving away four copies of Introducing JavaFX 8 Programming and have Herbert Schildt on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Assinging Compile time long constant to byte fails Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Introducing JavaFX 8 Programming this week in the JavaFX forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply locked New topic
Author

Assinging Compile time long constant to byte fails

Harish Kommaraju
Greenhorn

Joined: Nov 10, 2009
Posts: 13
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

Joined: Oct 27, 2005
Posts: 20128
    
  30

Please use one thread per question. Since you've already had one reply here that is where we shall continue.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6 - OCEJPAD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Assinging Compile time long constant to byte fails
 
It's not a secret anymore!