| Author |
acc ss modifier in array declarations
|
w.k.hasintha
Greenhorn
Joined: Oct 11, 2006
Posts: 4
|
|
|
can arrays be declared private ,public or protected .we have compilation errors while doing so why does this happen ?
|
 |
Ali Gohar
Ranch Hand
Joined: Mar 18, 2004
Posts: 572
|
|
Where are you trying to declare array as private, public or protected. I mean at class level or method level. Method level variables can't be declared as private, public, protected or static. Try to compile this, it will not raise error
|
 |
babudev Yam
Greenhorn
Joined: Jul 27, 2006
Posts: 8
|
posted

0
|
Array is also an object and so it cannot be treated like an field variable in a class. Maybe thats reason.
|
 |
wise owen
Ranch Hand
Joined: Feb 02, 2006
Posts: 2023
|
posted

0
|
Array is also an object and so it cannot be treated like an field variable in a class.
Why? If it is true then Ali'scode will have compile time errors.
|
 |
babudev Yam
Greenhorn
Joined: Jul 27, 2006
Posts: 8
|
posted

0
|
Yeah correct It doesnt make sense to give modifier to something declared in a method as it is local anyway !
|
 |
 |
|
|
subject: acc ss modifier in array declarations
|
|
|