0

netbean,why is my write is unexpected?

so im making a hangman game and im having a "expected type required:variable found:value", error please help. the mistake is similar to this mistake: String w1="abc",w2="cba"; w1.charAt(0)=w2.charAt(0);

7th Apr 2018, 5:04 AM
omer
1 Answer
+ 4
The charAt() function returns a character. You might wanna use some other function to replace that character with a new one. w1 = w1.replace(w1.charAt(0), w2.charAt(0));
7th Apr 2018, 5:27 AM
Dev
Dev - avatar