시작하기무료로 시작하기

스펠링 대회

스펠링 대회에 참가하셨어요! 도움이 되도록, 단어를 글자 단위로 분해해 주는 프로그램을 만들고자 해요.

이 연습은 강의의 일부입니다

중급 Java

강의 보기

연습 안내

  • toSpelllength를 가져오기 위해 올바른 메서드를 적용하세요.
  • for 루프를 시작하기 위한 올바른 키워드를 사용하세요.
  • i의 시작 값을 올바르게 설정하세요 — 첫 번째 문자부터 시작해야 해요.
  • toSpelli번째 위치에 있는 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));
    }
  }
}
코드 편집 및 실행