I know that I can't get to the non static method in that class so how do I use it?mainProgVideoStore.java:80: non-static method newCVideo(java.lang.String,int) cannot be referenced from a static context
And this is the method I want to use. in my Customer class
So now I have to make the newCVideo visible I have to make it static, ok well when I try that the compiler doesn't like that either and gives me the same error message because I'm using other nonstatic methods in that method. Would I have to make all of those methods static too?
Dustin Schreader wrote:so this works only because you put my in front of class Customer?
myCustomer is the name of the Customer instance- It can be anything- ourCustomer, customer, theCustomer, oneCustomer (any name which doesnt violate the naming convention, is not a keyword,reserved word and not the name of the Class).
In your case- You have a non-static method- newCVideo in Customer class. So to call/invoke this method(line 80) you would have to use an instance of Customer class (which you have created in line 12 of mainProgVideoStore). So the line 80 would now be:
Note: Pretty confusing to have the method and object name to be similar.
Joined: May 25, 2009
ok I understand, to lessen the confusion I changed it to myCustomer instead, thank you!
subject: non-static method cannot be referenced from a static context