Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Java Java Basics Perfecting the Prototype Censoring Words - Looping Until the Value Passes

Franklyn Van Dam
Franklyn Van Dam
403 Points

Need help. I'm not seeing what I got wrong.

// my error import java.io.Console;

public class TreeStory {

public static void main(String[] args) {
    Console console = System.console();

// my code

import java.io.Console;

public class Questions {

public static void main(String[] args) 
{
    Console console = System.console();

    String anyQuestions = console.readline("Are they any questions?  \n");
    while (anyQuestions.equals("yes")) 
    {
      String question = console.readline("What is your question? \n");
      console.printf("I do not understand your question: %s", question);
      anyQuestions = console.readline("Are there any more questions? \n");
    }

  console.printf("Next slide..."); 
  }
}
Franklyn Van Dam
Franklyn Van Dam
403 Points

I messed up coping error.... here it is....

Questions.java:9: error: incompatible types: String cannot be converted to boolean
String anyQuestions = console.readline("Are they any questions? \n");
^
Questions.java:12: error: incompatible types: String cannot be converted to boolean
String question = console.readline("What is your question? \n");
^
Questions.java:14: error: incompatible types: String cannot be converted to boolean
anyQuestions = console.readline("Are there any more questions? \n");
^
Note: Some messages have been simplified; recompile with -Xdiags:verbose to get full output
3 errors

1 Answer