• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Cannot make a static reference to the non-static method add()

 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I have made a simple class as shown below





When i tried this , i am getting this compile time error :

Cannot make a static reference to the non-static method add()

Please tell me whats the mistake i am making here .
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just what it says. The add method is not static and you are calling it as if it were.
 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Thanks .
forgot to create the Object for that interface .
 
Wouter Oet
Saloon Keeper
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First you need to create an implementation and then create an instance of it
 
Ravi Kiran Va
Ranch Hand
Posts: 2234
Eclipse IDE Firefox Browser Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks , i already created that , but did not post as the question might look too lengthy.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic