Usage of static and final keyword
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Anonymous
Posted On:   Thursday, March 23, 2006 07:02 AM

If you use both static and final for a variable what will happen?

Re: Usage of static and final keyword

Posted By:   WarnerJan_Veldhuis  
Posted On:   Thursday, March 23, 2006 08:00 AM

- static: the variable becomes a class variable, instead of an instance variable. This means all the instances share the same variable

- final: that variable cannot change:

final int i= 5;
i = 6; //<-- error

About | Sitemap | Contact