A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
this week in the
Other Open Source APIs
Programmer Certification (SCJP/OCPJP)
access modifier in loal variables
Joined: Jul 27, 2005
Jul 29, 2005 01:08:00
Why only 'final' be applied as access modifier in local variables? What is wrong with public,private and protected.
Debashree Halder<br />SCJP 1.5<br />Washington DC
Joined: Oct 11, 2004
Jul 29, 2005 02:23:00
Because no need for other.
Joined: Jul 28, 2005
Jul 29, 2005 02:56:00
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 ...so there is no need for access modifiers like public,private r protected ....
thanks & regards
Thanks & Regards<br /> <br />-Srikanth
Joined: Oct 13, 2003
Jul 29, 2005 20:33:00
because, purpose of final is to declare constant variables.
Anbudan & Mahalo,<br />Arul<br /> <br />-Not a sun certified Java professional :-)
I agree. Here's the link:
subject: access modifier in loal variables
What order should the access and non access modifiers be specifed
Volatile - synchronized ?
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015