id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

sspiege3@schools.nyc.gov consumerlab

Answer the following question (it will help you with numWords)

What is the output of the following code segment?

     String phrase = "Here is the word";
     int psn = phrase.indexOf("e");
     while (psn >= 0){
        System.out.print(psn);
        phrase = phrase.substring(psn + 1);
        psn = phrase.indexOf("e");
   }

(A) 116

(B) 227

(C) 1310

(D) 2411

(E) Many digits will be printed due to an infinite loop.

Complete the following problems:

endsLy  //if you have to write the header, please leave out the word static

alphabetize  numWords H   withoutX 
Authoring docs

Copyright Nick Parlante 2017 - privacy