小编JHu*_*rst的帖子

使用Scanner的字符串数组

在我的程序中,我需要创建一个字符串数组,允许用户使用扫描仪在控制台中一个接一个地输出最多100个文本字符串.然后我需要程序能够显示当用户键入单词'stop'时键入的所有字符串(<= 100).

我不是指望任何人为我编写整个程序,但可能只是一些提示?

我确信这是非常基本的,但我对java很新,我不能让这个模块失败,任何帮助都非常感谢!

package assignment2017;

import java.util.Scanner;

public class FootballResultsGenerator {

    public static void main(String[] args) {



        String m = (" : ");
        String promptA = ("Goals scored by: ");
        String resultA = ("Results: ");
        String awayTeamGoals = ("the away teams scored: ");
        String homeTeamGoals = ("the home teams scored: "); 
        String totalGoals = ("Total number of goals: ");

                int numberOfGames=0;

                String lineSplit = ("-------------------------------------------");
        //These are my teams.

        //home
        String ah = ("Tottenham Hotspur(Home)");
        String gh = ("Sunderland(Home)"); …
Run Code Online (Sandbox Code Playgroud)

java arrays string java.util.scanner

0
推荐指数
1
解决办法
586
查看次数

标签 统计

arrays ×1

java ×1

java.util.scanner ×1

string ×1