Win a copy of Machine Learning for Business: Using Amazon SageMaker and JupyterE this week in the Jython/Python forum
or Object Design Style Guide in the Object-Oriented programming forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
  • Knute Snortum
Sheriffs:
  • Liutauras Vilda
  • Tim Cooke
  • Junilu Lacar
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Joe Ess
  • salvin francis
  • fred rosenberger

Trying to understand classes

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • 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: 11221
244
  • Mark post as helpful
  • send pies
  • 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: 12796
51
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • 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: 2483
108
Google Web Toolkit Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • 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 llama doesn't want your drama, he just wants this tiny ad for his mama
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!