Question: //CountMovieSpaces.java public class CountMovieSpaces { public static void main(String[]args) { //declare a string to read movie quote String movieQuote=They say that the best blaze burns

//CountMovieSpaces.java public class CountMovieSpaces { public static void main(String[]args) { //declare a string to read movie quote String movieQuote="They say that the best blaze burns brightest when circumstances are at their worst."; /*declare an integer and initialize to zero to count spaces.*/ int spaceCount=0; /*Iterate over the movieQuote string to find spaces.*/ for (int index = 0; index < movieQuote.length(); index++) { if(Character.isSpace(movieQuote.charAt(index))) //increment the count of spaceCOUNT by one spaceCount=spaceCount+1; } //print movie quote System.out.printIn("Movie Quote: "+movieQuote); //print spaces count System.out.printIn("Number of spaces in quote: "+spaceCount);

}

PLEASE HELP! I am not sure what I did wrong with this java code!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!