This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes access modifier in loal variables Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "access modifier in loal variables" Watch "access modifier in loal variables" New topic

access modifier in loal variables

Debashree Halder
Ranch Hand

Joined: Jul 27, 2005
Posts: 81
Why only 'final' be applied as access modifier in local variables? What is wrong with public,private and protected.

Debashree Halder

Debashree Halder<br />SCJP 1.5<br />Washington DC
ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
Because no need for other.
srikanth reddy
Ranch Hand

Joined: Jul 28, 2005
Posts: 252
The final modifier is a non-access modifier which can b applied to class,method r variable..the local variable has the scope of only the method itself there is no need for access modifiers like public,private r protected ....

thanks & regards

Thanks & Regards<br /> <br />-Srikanth
Arulkumar Gopalan
Ranch Hand

Joined: Oct 13, 2003
Posts: 104
because, purpose of final is to declare constant variables.

Anbudan & Mahalo,<br />Arul<br /> <br />-Not a sun certified Java professional :-)
Have you checked out Aspose?
subject: access modifier in loal variables
It's not a secret anymore!