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
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
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Programmer Certification (OCPJP)
static memebrs!
Sridhar Srinivasan
Ranch Hand
Posts: 117
posted 20 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
a static reference cannot be made through non static
method or code block. � Is this correct?
How abt the following which compiles fine.
class StaticPlays { public static void aMethod() {} public void anotherMethod() {aMethod();} }
Can anybody explain please?Thanks
Software_guy
Rama Kumar PV
Greenhorn
Posts: 26
posted 20 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Sridhar,
You can refer to both static and non-static members from within a non-static method but not the other way round. That's why your piece of code compiled fine..
Cheers,
Rama
Sridhar Srinivasan
Ranch Hand
Posts: 117
posted 20 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Oh!ok.Got it.Thanks a lot!
Software_guy
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
abstract example
abstract/concrete methods and modifiers
Static methods invocation .....
Getting Name of current Method
Achieving inheritance without extends
More...