java 问题求助
我是新人,刚刚开始学java。现在在做 hangman game
我中文表达的可能不太好,我现在在滑铁卢大学学computer science,一些java 中文的术语不太清楚。。。希望大家能明白我说的意思就行。~
想问一下高手,
假设我输入了一个字母 String n = a ;
System.out.println ("The letter "+ n + " occurs at the following locations in the word: " + comp.whereIsLetterInWord(n));
String theWordis = comp.whereIsLetterInWord(n);
System.out.println ("The word is: " + theWordis );
输出:
Enter a letter: a
The letter 'a' occurs at the following locations in the word: _____a__
The word is: _____a__
这个是没有问题的,但是如果我再输入一个r的话
输出:
Enter a letter: r
The letter 'a' occurs at the following locations in the word: __r_____
The word is: __r_____
我如何让我输入r之后显示如下:
Enter a letter: r
The letter 'r' occurs at the following locations in the word: __r_____
The word is: __r__a__