Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

non-static variable this cannot be referenced from a static context

 
Timothy Toe
Ranch Hand
Posts: 156
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Why ?
 
Keen Chen
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi
if u wanna a inner class (not static)object, u do this: new.Outer().new Inner(). must need a Outter class object reference first. right?
but , in a static method ,not exist a reference(unless u NEW it).
because static method is pertain a class,
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic