• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Java prog help

jai6638

Golden Member
Hey... I need some help with the program. The idea is for the person to guess the word ( specified in program .. its essentially a game of hangman). He gets 10 chances and everytime he guesses the right letter, it replaces the spot in a string of dashes..

My compiler doesnt work.. tried reinstalling it but to no avail. I'd appreciate it if you guys could tell me if there are any problems in this program or not.

 
Originally posted by: notfred
Fix your compiler.

I tried to but it doesnt seem to detect the "terminal io" package even though its int he folder.


Can you recommend any compiler which I could use ??

Thanks..
 
What do you mean that your compiler doesn't work? Does it give you a class not found exception, or does it literally not work? If the TerminalIO package is in a jar file, you might need to modify your classpath to point to it.
 
Well the TerminalIO file is in the bin directory which is where my program is located. When I try compiling, it gives me an exception that the TerminalIO class could not be found
 
TerminalIO should not be a file, it should be a directory with class files in it. And is your source in your bin directory or is that just where you're directing the compiler to place the compiled code. You'll probably either have to add the bin directory to the CLASSPATH environment variable, or use the -classpath argument to the compiler (preferred method).
 
How would would add it to the "classpath environment variable or use the -class path argument to the compiler"?

Also, am currently at the library and tried compiling my program and made some changes. It still doesnt compile:


It gives me the error "cannot resolve symbol" for following statement:

dashes=dashes.substring(0,doh+userInput+dashes.substring(doh,dashes.length()));

Any ideas? The substring should work since its the right syntax imo.
Thanks.

 
java.lang.String.substring has two signatures, neither of which you're using. Look at the parameters you're passing in

String = String.substring( int, int + char + String );

Where the last occurence of String is actually a return value from a validly-formatted call to substring.
 
Please learn about compiling if you have problems. Google will help you and the journey will teach you many other things. If you can't trouble shoot something like this, you'll never make it a s a programmer in the real world.

<== jerk

edit: I take that back. People have said what is wrong, now it's time to do some research on the stated topics.
 
Back
Top