スペリングビー
あなたはスペリングのコンテストに参加しています! その助けとして、単語を文字ごとに分解するプログラムを作りたいと考えています。
この演習はコースの一部です
中級 Java
演習の手順
toSpellのlengthを取得する正しいメソッドを使ってください。- for ループを開始する正しいキーワードを使ってください。
iの開始値を正しく設定してください。最初の文字から始めます。toSpellのi番目の位置にあるcharを取得する正しいメソッドを書いてください。
実践的なインタラクティブ演習
このサンプルコードを完成させて、この演習に挑戦してみましょう。
class Speller {
public static void main(String[] args) {
String toSpell = "conscientious";
// Choose the correct method on toSpell to retrieve its length
int wordLength = toSpell.____();
// Use the right keyword and put the starting correct value into i
____ (int i = ____; i < wordLength; i++) {
// Write down the correct method to retrieve the character at the ith position
System.out.println(toSpell.____(i));
}
}
}