这里是我到目前为止的代码(当然,while循环):while循环,尽管条件不是循环得到满足
public class Lab10d
{
public static void main(String args[])
{
Scanner keyboard = new Scanner(System.in);
char response = 0;
//add in a do while loop after you get the basics up and running
String player = "";
out.print("Rock-Paper-Scissors - pick your weapon [R,P,S] :: ");
//read in the player value
player = keyboard.next();
RockPaperScissors game = new RockPaperScissors(player);
game.setPlayers(player);
out.println(game);
while(response == ('y'))
{
out.print("Rock-Paper-Scissors - pick your weapon [R,P,S] :: ");
player = keyboard.next();
game.setPlayers(player);
//game.determineWinner();
out.println(game);
out.println();
//
}
out.println("would you like to play again? (y/n):: ");
String resp = keyboard.next();
response = resp.charAt(0);
}
}
它应该运行代码的其他次,直到正被输入
当我输入唉,它应该重新运行的代码,但不会
......和你的问题是什么? – apnorton
您的括号已关闭 – epascarello
并且您有不匹配的括号?我们可以看到完整的代码吗? – u8sand