如何在文件菜单中添加一个数组,下面的代码让我为每个艺术家输入 10 位艺术家和 10 首歌曲。
import java.io.*;
public class Music {
public static void main(String[] args) throws IOException
{
BufferedReader stuff = new BufferedReader(new InputStreamReader(System.in));
String inData;
int [] [] MUSIC = new int [2] [10];
for (int counter = 0; counter <= 1; counter++)
{
System.out.print( "Enter Artist: ");
inData = stuff.readLine();
for (int index = 0; index<=9 ;index++)
{
System.out.print( "Enter Record: ");
inData = stuff.readLine();
}
}
System.out.println( "Below is a printout");
for (int counter = 0; counter <= 20; counter++)
{
System.out.print("The nos on Row "+ counter + " are ");
for (int index = 0; index<= 20;index++)
{
}
System.out.println();
}
}
}
我相信我需要在此处放置类似于案例 1 的内容,并且可能需要在 main 上方的类中编写文件的代码。