• 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:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Help with deck of cards.

 
Sheriff
Posts: 17734
302
Mac Android IntelliJ IDE Eclipse IDE Spring Debian Java Ubuntu Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Staying with the metaphor still...

Now, let's say the foreman is constructing a number of similar houses in a subdivision. That means he uses pretty much the same blueprint to build each house. Let's say a customer comes in and says, "Hey, I want my window in the living room to be taller, so I get more sunlight to come in. Can you do that?" The foreman says, "Ok, I'll get that done for you." (Let's just assume that all the paperwork and money matters are taken care of so that the change can actually be done).  A few days later, the foreman calls in his window installer. He goes to his file cabinet and pulls out a generic blueprint of the kind of house in question and says, "Hey, I need you to change this window over here and make it taller. The owner wants more sunlight to come in." He points to the living room window in the blueprint.  The foreman looks up at the foreman, confused. "Ok... which house do you want me to change that window on? We've got 18 houses that are following this plan. You're pointing at the plan. I need you to point me to the actual house that has the window that needs to be changed."  

The window guy just threw a "Non-static variable cannot be accessed from a static context" error at the foreman.

The foreman says, "Oh, right. It's the house on lot #3198."

The foreman just put an object reference (the house on lot #3198) in front of the instance variable reference (the living room window).

The window guy says, "Ok, you got it, boss."

The window guy just compiled the command successfully.

Does that make sense?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic