Yak*_*iah -1 java eclipse arrays break while-loop
我已经为程序创建了基本结构,但无论我尝试什么,我似乎都无法退出循环.
我还希望它显示用户输入的信息; 一旦我退出循环,从键盘到控制台,但我不知道如何做到这一点.
import java.util.Scanner;
public class Requirement1 {
public static void main(String[] args) {
Scanner scan = new Scanner (System.in);
String name, game, time, points;
int i = 0;
System.out.println("Please Enter Your Name");
name = scan.nextLine();
System.out.println("Players Name: " + name);
while (i < 100)
{
Scanner scan2 = new Scanner(System.in);
System.out.println("Please Enter a Game Name (If You Are Done type \"quit\")");
game = scan.nextLine();
System.out.println("Game: " + game);
Scanner scan3 = new Scanner (System.in);
System.out.println("Please Enter Your Score");
points = scan.nextLine();
System.out.println("Your Score: " + points);
Scanner scan4= new Scanner (System.in);
System.out.println("Please Enter the amount of time Spent Playing in Minutes");
time = scan.nextLine();
System.out.println("Time played: " + time);
}
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
121 次 |
最近记录: |