• Post Reply Bookmark Topic Watch Topic
  • New Topic

static method vs instance  RSS feed

 
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,



in above example.. i access static method through instance of class Ken..

i know that we can access static method through reference of class .. compilar substitute it with class name..

well, but what about above example?
 
Marshal
Posts: 56606
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A bit of bad programming which is permissible Java syntax, but bad practice. You ought always to access static members using the class name, but the compiler tolerates use of an object name.
 
Seetharaman Venkatasamy
Ranch Hand
Posts: 5575
Eclipse IDE Java Windows XP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i got it Cambpell ...THANKS
 
Campbell Ritchie
Marshal
Posts: 56606
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're welcome
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!