aspose file tools
The moose likes Beginning Java and the fly likes when will be final fileds loaded Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Beginning Java
Reply Bookmark "when will be final fileds loaded" Watch "when will be final fileds loaded" New topic
Author

when will be final fileds loaded

saikrishna cinux
Ranch Hand

Joined: Apr 16, 2005
Posts: 689
Hi,
When will be final fields get loaded?
and what are the advantages of being final varaibles and eing final static variable?

thanks,
Sai


A = HARDWORK B = LUCK/FATE If C=(A+B) then C=SUCCESSFUL IN LIFE else C=FAILURE IN LIFE
SCJP 1.4
saikrishna cinux
Ranch Hand

Joined: Apr 16, 2005
Posts: 689


Is it a right way to declare final where ever i used in thi program?
Anoobkumar Padmanabhan
Ranch Hand

Joined: Aug 08, 2007
Posts: 103
But, is there any need to specify the parameter of constructor as final???
I think no...


Thanks<br /> <br />Anoobkumar<br />SCJP 1.5
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24057
    
  13

Originally posted by Anoobkumar Padmanabhan:
But, is there any need to specify the parameter of constructor as final???
I think no...


Some folks believe it makes sense to declare all parameters as final. Modifying the parameters of a method can lead to confusing code, and marking them as final prevents that.


[Jess in Action][AskingGoodQuestions]
Anoobkumar Padmanabhan
Ranch Hand

Joined: Aug 08, 2007
Posts: 103
Hi Friedman-Hill


Modifying the parameters of a method can lead to confusing code, and marking them as final prevents that.


I couldn't get the meaning of that. Could you please explain that concept?
Ravikanth kolli
Ranch Hand

Joined: Feb 10, 2008
Posts: 179

As far as i can think, EFH means that people do believe that declaring parameters as final do help, because the parameter cannot be modified and thus prevents erroneous code.


-kolli
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: when will be final fileds loaded
 
Similar Threads
Basic concept for memory allocation
Array Initialization Doubt
FINAL instance variable
final variable
Why local inner classes CAN "see" final variables?