• 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:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

Trying to understand classes

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Greetings, i am trying to get an understanding of classes and i am hard stuck on an error for the following code:



the output:

 
Saloon Keeper
Posts: 14267
321
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The error tells you exactly what's wrong. Carefully compare the method declaration with the method call.
 
lowercase baba
Posts: 13071
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When i get weird errors like this, I will cut'n'paste the exact thing it says it can't find and search for it...and 100% of the time, there is a valid reason Java can't find it.  You will not be able to find a method called "playit" defined anywhere in the code you posted.
 
Bartender
Posts: 2908
150
Google Web Toolkit Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As others have pointed above, you have a typo in your method name. If you read the error line by line, it first says that the error lies in line 26 of your program.
Next, it also states the "symbol" it cannot find is a method and the name of the method. This gives you all the clues you need to solve the issue.

Another variant of this error is if you had written something like foo.playit() instead of two.playit():
In this case, the error is in the name of the variable. And the "symbol" rightly points out that too. Notice that the caret symbol (^) is at a different location.

Hope this helps you to solve such issues.
 
This cake looks terrible, but it tastes great! Now take a bite out of this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic