wood burning stoves
The moose likes Java in General and the fly likes i'm desperate Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "i Watch "i New topic

i'm desperate

khella smith
Ranch Hand

Joined: May 06, 2002
Posts: 39
hi again,
wat does it mean when u have
final int i = 10;
byte k = i;
u compile this and u get no error
but when u take out the final modifier u get an error. does it have something to do with the final being regarded as a constant or what
some explanations would be highly regarded
Cindy Glass
"The Hood"

Joined: Sep 29, 2000
Posts: 8521
Yes, when the variable is final it is treated as a constant that the jvm knows will fit into a byte. As soon as you remove the final attribute, then the variable is at risk of being something that will NOT fit into a byte, and you get an error.

"JavaRanch, where the deer and the Certified play" - David O'Meara
khella smith
Ranch Hand

Joined: May 06, 2002
Posts: 39
thanxs cidy
now i can answer a question with more confidence
I agree. Here's the link: http://aspose.com/file-tools
subject: i'm desperate
It's not a secret anymore!