• 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
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

help in debugging

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi.

I've been typing the code for the Sink-a-dotcom game from the Head First:Java book. I encountered problems on compile time though.

First, compared what i typed with the one in the book. when i didnt find any difference (except for bracket placements and spacing) in the two, i downloaded the code from the site and tried to compile the downloaded code (it worked). i tried to check whether i typed something wrong or forgot to enter a line and this time compared it to the downloaded code. Again, i didnt find anything different between the two.

And that's my question, what did i do wrong?

I encounter the problem on both of the source files for the game.

Here's the error for the Game helper file (changed the directory):



And here's the error for the main Dot Com Bust file solved


Here's the code i copied from the book followed by the code downloaded from wickedlysmart.com (the problem probably is in the first few lines but i added the whole things just in case) :

Game Helper file:

TYPED



DOWNLOADED



Dot Com Bust file: solved
 
Bartender
Posts: 563
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The error message is very helpful. Compare line 5 of Typed to line 4 of Downloaded as shown in the last 2 files posted.
 
lowercase baba
Posts: 13081
67
Chrome Java Linux
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you tell me, where EXACTLY in your code, you define the Gamehelper class?

(remember, Java is case sensitive)
 
Jose Kampilan
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@Greg Brannon: thanks. cant believe i didnt see that. it was staring at me in the face. changed the h to H and the DotComBust file compiled and ran.

@fred rosenberger: not sure about this: is it the whole gamehelper file? from line 4 to line 86?

changed the directory for the game helper file from the "holding" folder to the main "JavaProjects" folder. Still gave me the same error though



the next thing i did was to copy-paste that part of the code from "downloaded" one to the "typed" one. this time it gave a different error.



i checked whether the placeDotCom class was missing a bracket. but it looks like the all the brackets for that class are complete.
 
Ranch Hand
Posts: 375
1
Python Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Jose Kampilan wrote:@Greg Brannon: thanks. cant believe i didnt see that. it was staring at me in the face. changed the h to H and the DotComBust file compiled and ran.

@fred rosenberger: not sure about this: is it the whole gamehelper file? from line 4 to line 86?

changed the directory for the game helper file from the "holding" folder to the main "JavaProjects" folder. Still gave me the same error though



the next thing i did was to copy-paste that part of the code from "downloaded" one to the "typed" one. this time it gave a different error.



i checked whether the placeDotCom class was missing a bracket. but it looks like the all the brackets for that class are complete.



Did you noticed that, you are using: - toLowercase() instead of toLowerCase() [* C capital ]

This is the general naming convention in Java. Edit it to see the desired output.
 
Jose Kampilan
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@R. Jain: wow thanks. changed the cases and it worked. i really need to be careful with the cases (that's the second time now).
 
Climb the rope! CLIMB THE ROPE! You too tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic