This week's book giveaway is in the Security forum.
We're giving away four copies of Securing DevOps and have Julien Vehent on-line!
See this thread for details.
Win a copy of Securing DevOps this week in the Security forum!
    Bookmark Topic Watch Topic
  • New Topic

Static mmbers  RSS feed

 
Greenhorn
Posts: 18
  • Mark post as helpful
  • send pies
  • Report post to moderator
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.
 
Ranch Hand
Posts: 1710
  • Mark post as helpful
  • send pies
  • Report post to moderator
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.
 
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Report post to moderator
Can we carry on the discussion of this question in this duplicate post
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!