Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • 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
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Extreme beginner-code won't work

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am currently working my way through the head first java book and am completely stuck.
I am trying to write the mini battleship(re-written by me to involve the finding of a stolen Lamborghini)
game, and can't get it to compile right. I've gone over it for an hour straight and can't find what is wrong.


class 1:


class 2:


ERROR:


What am I doing wrong? Is it a typo that I haven't found?

Thanks
 
Sheriff
Posts: 21759
102
Eclipse IDE Spring VI Editor Chrome Java Ubuntu Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please UseCodeTags next time. I've added both them and indentation for you.

StolenLambo does not have these methods; CheckLambo does. Perhaps you meant to turn line 5 into as CheckLambo does have them. Or perhaps you meant to make StolenLambo extend CheckLambo (thereby letting StolenLambo inherit the methods) and simply forgot.
 
Clayton Easterbrooks
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ah ok I'll make sure to post code in that format from now on.


I figured it out. I simply put the CheckLambo code minus the class declaration inside
the StolenLambo class, inside only the class brackets. Works now. Thanks.

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!