Win a copy of Machine Learning with R: Expert techniques for predictive modeling this week in the Artificial Intelligence and Machine Learning 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
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

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: 21805
104
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.

 
30 seconds to difuse a loaf of bread ... here, use this tiny ad:
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!