• 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
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

class and testclass

 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello :-)

I am working throught the head first book, and the subject now is about making a class and testclass. I get the impression that these two files should be seperate, so with one of the exercises I had to do I did;



and the testclass;



When I run it, it seems to compile, but then an error emerges;

DrumkitTestDrive.java:13: cannot find symbol
symbol : method playsnare()
location: class Drumkit
d.playsnare();
^

there's another one that says java:10:.

I've looked on the internet, and get the impression that something is not installed to make it work. Is this true?
 
author
Posts: 23923
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

DrumkitTestDrive.java:13: cannot find symbol
symbol : method playsnare()
location: class Drumkit
d.playsnare();



Java is case sensitive. The method is playSnare(), with a capital S. The compiler can't find one with the lower case s.

Henry
 
Besjamain Greenaway
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks a lot! But wow, is that emberassing! Just a simple syntax prob
 
Marshal
Posts: 75867
361
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
We have all made that sort of mistake. You could have written play Snare() instead, which has another error in.

Please don't write "if (d.snare == true) . . ." Write "if(d.snare) . . ." The "== true" is unnecessary. Try it.
 
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic