Forums Register Login

Static mmbers

+Pie Number of slices to send: Send
if static methods are restricted to call only staic methods and data,
how can main() be static and yet call any kind of methods or data.
+Pie Number of slices to send: Send
Hi Jack,

Welcome to JavaRanch!!!

How do you find your statement to be correct?
Can you come up with an example?

Static method can't access non-static method or instance member, because
there is no "this" reference in it. The same applies to main() method also.
+Pie Number of slices to send: Send
Can we carry on the discussion of this question in this duplicate post
You know it is dark times when the trees riot. I think this tiny ad is their leader:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


Reply locked
This thread has been viewed 824 times.
Similar Threads
static
static and non-static synchronized methods
understanding static
non-static variable cl cannot be referenced from a static context
static variables
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 19, 2024 03:28:49.