Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within OCPJP
Search Coderanch
Advance search
Google search
Register / Login
Win a copy of
Getting started with Java on the Raspberry Pi
this week in the
Raspberry Pi
forum!
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Ron McLeod
Paul Clapham
Tim Cooke
Jeanne Boyarsky
Sheriffs:
Rob Spoor
Devaka Cooray
Liutauras Vilda
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Tim Moores
Mikalai Zaikin
Bartenders:
Piet Souris
Forum:
Programmer Certification (OCPJP)
acc ss modifier in array declarations
w.k.hasintha
Greenhorn
Posts: 4
posted 16 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
can arrays be declared private ,public or protected .we have compilation errors while doing so why does this happen ?
Ali Gohar
Ranch Hand
Posts: 572
posted 16 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
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.
class TestArray{ public int[] array1; private int[] array2; protected int[] array3; }
Try to compile this, it will not raise error
babudev Yam
Greenhorn
Posts: 8
posted 16 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
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
Posts: 2023
posted 16 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
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
Posts: 8
posted 16 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Yeah correct
It doesnt make sense to give modifier to something declared in a method as it is local anyway !
How do they get the deer to cross at the signs? Or to read this tiny ad?
Low Tech Laboratory
https://www.kickstarter.com/projects/paulwheaton/low-tech-0
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
1D array
Trouble with compiling?
String array
String args[]
how to calculate number of arguments in a function
More...