What is the
screen object in your code:
Your general idea can work, except you won't want to use == to compare Strings since == tests to see if two String *objects* (or any objects for that matter) are one and the same. Rather you want to check if two Strings contain the same content -- the same letters and in the same order, and for that you should use the equals(...) or equalsIgnoreCase(...) methods. Also your String literals should be surrounded by "", and so you'll be checking to see if one Strings holds "yes" or "no":
// we'll use equalsIgnoreCase since we don't care
// if the user types in "yes" or "Yes" or "yeS"
if ("yes".equalsIgnoreCase(answer)) {
// do something
}
Note that I prefer the above code to this:
if (answer.equalsIgnoreCase("yes")) {
// do something
}
because with the former code, I reduce the chances of getting a NullPointerException in case answer is null.