this line here:
private Hangman hang;
is saying create a private variable of type "Hangman" with name "hang" however the class "Hangman" hasn't been made.
ie your class is called "Hangman2"
so if i wanted to make a variable for your class id go
private Hangman2 hang2;
so either you haven't written the class Hangman and compiled it. its not in the same directory as the Hangman2 class, or you've spelt something wrong
----edit-----
and the string thing. well i've never needed 2 do it be4 so theres proly a better way to do this BUT.
you could pt it into a char array and then change a value and pt it back into the string?
you could create a temp copy of the string. set the orig to empty then write a for loop to add the chars from the temp string back in. (during the for loop u might say if (i==2) {org += "a"} this would then change the specified letters)
a little more advance way might be 2:
use CharSequence to copy everything be4 the character to be changed. add that 2 a new string and the new letter then copy everything after it?
or finally u can use the replace method but thts hard to work with if u have more then one of the same character
java
String sts = "hello";
System.out.println(sts);
sts = sts.replace('e', 'l'); //replaces e with l
System.out.println(sts)
This post has been edited by gl3thr0: 6 Jun, 2008 - 11:17 AM