0

Everything about this code works fine, except the while loop won't end, even when the strings are perfectly matched. Help, please?

import java.util.Scanner;


public class SecretPhrase
{

	public static void main(String[] args)
	{

		System.out.println("Congratulations! You won! Thanks for playing!");
			
		
	} 

}

Edited by thedalek: n/a

2
Contributors
2
Replies
3
Views
6 Years
Discussion Span
Last Post by thedalek
1

Don't use == or != to compare Strings. Use the equals() method.

Also indent you loops and if() blocks. It makes the program flow much easier to follow.

Votes + Comments
Very helpful.
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.