[final] [static] {TYPE}. What the difference?

Hi!Can anyone explain what the difference between next lines of code:int i;static int i;final static int i; ?Thank you!
[161 byte] By [aiRa] at [2007-10-2 14:26:44]
# 1
look up the defintions of the keywordsstatic = accessible without class instancefinal = assignable only once; either at declaration or in a constructor (or initialiser block).
watercolour...yesa at 2007-7-13 12:46:52 > top of Java-index,Java Essentials,Java Programming...
# 2
You have screwed up now. Once watercolor...yes does your homework for you you owe him seventy ewes, ninety calves, and your first born child.Drake
Drake_Duna at 2007-7-13 12:46:52 > top of Java-index,Java Essentials,Java Programming...
# 3
All those I owed -- they're all forgiven:)Thanx a lot!Still didn't get why this needs for... In OOP specifically. An examples I've seen do not follow this at all... May be there are the espesial memory management in wireless...Thanx anyway!
aiRa at 2007-7-13 12:46:52 > top of Java-index,Java Essentials,Java Programming...
# 4

There are three kinds of memory allocation in java.

1) Local variables defined within methods which are stored on the Stack. Each method call creates a stack block where local variables are stored.

2) Instance fields created when you create an object with new. These are the fields declared outside of methods without the static modifier.

3) Static, or "class" fields. These are stored in a single block of memory associated with each class of objects, so they are independant of any particular instance of the class.

(Arrays are just a special kind of object)

final is mostly to protect you from mistakes involving changing things that aren't supposed to change. It also allows the compiler to do some clever stuff. For example only final values can be used in the cases of swith statements. And the compiler sometime compiles in a final static value as if it were a literal, since the value can be known when compiling.

malcolmmca at 2007-7-13 12:46:52 > top of Java-index,Java Essentials,Java Programming...
# 5
Yes! Thank you!It is quite clear now.To Drake_Dul:Do not post any dull useless messages. Don't waste valuable time and space. Save the world - kill yourself!
aiRa at 2007-7-13 12:46:52 > top of Java-index,Java Essentials,Java Programming...
# 6

> Yes! Thank you!

> It is quite clear now.

> To Drake_Dul:

> Do not post any dull useless messages. Don't waste

> valuable time and space. Save the world - kill

> yourself!

Why would you return 6 months later to edit this message and add the flame to your post? Are you trying to set a world record for the world's slowest flamewar?

cotton.ma at 2007-7-13 12:46:52 > top of Java-index,Java Essentials,Java Programming...
# 7
Maybe it took them all that time to come up with a witty retort. On second thoughts, they need a bit more time to work on it.
floundera at 2007-7-13 12:46:52 > top of Java-index,Java Essentials,Java Programming...
# 8

> > Yes! Thank you!

> > It is quite clear now.

> > To Drake_Dul:

> > Do not post any dull useless messages. Don't waste

> > valuable time and space. Save the world - kill

> > yourself!

>

> Why would you return 6 months later to edit this

> message and add the flame to your post? Are you

> trying to set a world record for the world's slowest

> flamewar?

I give up. How did you figure out that that was the post that was edited and hence bumped the thread? Compare against google archives?

jverda at 2007-7-13 12:46:52 > top of Java-index,Java Essentials,Java Programming...
# 9

> > > Yes! Thank you!

> > > It is quite clear now.

> > > To Drake_Dul:

> > > Do not post any dull useless messages. Don't

> waste

> > > valuable time and space. Save the world - kill

> > > yourself!

> >

> > Why would you return 6 months later to edit this

> > message and add the flame to your post? Are you

> > trying to set a world record for the world's

> slowest

> > flamewar?

>

> I give up. How did you figure out that that

> was the post that was edited and hence bumped the

> thread? Compare against google archives?

Well you'll notice I seemed to resurrect this thread from the dead right.. All of a sudden it showed up on the top of the list (before I posted) and I thought that was odd. And I saw all the posts including the last one. I figured someone had edited but I didn't know how or what.

Then it got bumped again and this time the "kill yourself" line was added.

I have no idea what's going on in this guy's head.

cotton.ma at 2007-7-13 12:46:52 > top of Java-index,Java Essentials,Java Programming...
# 10

> Well you'll notice I seemed to resurrect this thread

> from the dead right..

throw new ParseException("WTF?");

> All of a sudden it showed up on

> the top of the list (before I posted) and I thought

> that was odd. And I saw all the posts including the

> last one. I figured someone had edited but I didn't

> know how or what.

>

> Then it got bumped again and this time the "kill

> yourself" line was added.

Ah.

> I have no idea what's going on in this guy's head.

Indeed. Truly bizarre.

jverda at 2007-7-13 12:46:52 > top of Java-index,Java Essentials,Java Programming...
# 11
> I have no idea what's going on in this guy's head.Probably the dance of the sugar plum fairies!
floundera at 2007-7-13 12:46:52 > top of Java-index,Java Essentials,Java Programming...
# 12

:))) You don't know how to busy yourself? Ok, I'd explain a little:

1. The hardcore humor sometimes is misunderstandable by different peoples, what to say about different nations? So, be careful, do not hurt someone!

2. An empty message from Drake make me read others messages from that guy. More than 500! Wow? And how many useful among that ones?

3. Too slow? Sorry for me was not sitting at this subj 24 h/d.

Stop the flooding! ;)

aiRa at 2007-7-13 12:46:52 > top of Java-index,Java Essentials,Java Programming...
# 13
What flooding?
floundera at 2007-7-13 12:46:52 > top of Java-index,Java Essentials,Java Programming...
# 14
Are you KIDDING? You took SIX MONTHS. SIX MONTHS to reply. Nobody cares about your stupid flame, we're all scratching our heads at why someone would come back SIX MONTHS LATER to flame.
kablaira at 2007-7-13 12:46:52 > top of Java-index,Java Essentials,Java Programming...
# 15
Explanation coming.Please stand by...
cotton.ma at 2007-7-20 22:15:55 > top of Java-index,Java Essentials,Java Programming...
# 16
This is taking a while, mind if I sit instead?
floundera at 2007-7-20 22:15:55 > top of Java-index,Java Essentials,Java Programming...
# 17
> This is taking a while, mind if I sit instead?Go right ahead. To be honest the ETA for the snappy comeback is ~ December 7th. Your patience is appreciated.
cotton.ma at 2007-7-20 22:15:55 > top of Java-index,Java Essentials,Java Programming...
# 18
2008?
floundera at 2007-7-20 22:15:55 > top of Java-index,Java Essentials,Java Programming...
# 19

> 1. The hardcore humor sometimes is misunderstandable

> by different peoples, what to say about different

> nations? So, be careful, do not hurt someone!

What is this shite?!? Who said anything about any nations? Nobody said a goddamned thing. This really does piss me off.

"Hi I'm an idiot"

"Yes you are"

"Racist!"

Truly. What the ****.

cotton.ma at 2007-7-20 22:15:55 > top of Java-index,Java Essentials,Java Programming...
# 20

> :))) You don't know how to busy yourself? Ok, I'd

> explain a little:

> 1. The hardcore humor sometimes is misunderstandable

> by different peoples, what to say about different

> nations? So, be careful, do not hurt someone!

> 2. An empty message from Drake make me read others

> messages from that guy. More than 500! Wow? And how

> many useful among that ones?

> 3. Too slow? Sorry for me was not sitting at this

> subj 24 h/d.

> Stop the flooding! ;)

aiR,

Please note, this is not meant as a disparagement of non-native speakers of English. However, the fact is that the vast majority of the people on this site are English speakers, and most of them probably Americans. Hence, English is the lingua franca of this site, and most readers will have no idea what you're talking about if you don't write reasonable, clear, coherent English.

Please repost after you have learned English.

Thank you!

jverda at 2007-7-20 22:15:55 > top of Java-index,Java Essentials,Java Programming...
# 21
> Explanation coming.> > Please stand by...I'll check back in March, 2007.
jverda at 2007-7-20 22:15:55 > top of Java-index,Java Essentials,Java Programming...