因此,我正在开发一个名为 Notes 计数器的程序。在第二个 java 文件中,我想要的是询问用户,他/她想要添加多少注释,然后按顺序显示所有注释(1.2.....)
我无法将多个 JOoptionPane.showInpuDialogs 放入一个数组中 – user2547460 31 秒前编辑
对于这一行:
for(int i = 0; userEnterADD >i;i++){
String add1 = JOptionPane.showInputDialog("Enter your note here!");
numberNotes= new String[userEnterADD];}
abobe 方法应将来自 JOoptioPane 的所有用户答案放入一个数组中。所以稍后我可以将用户为 JOOptionPane 输入的所有注释打印为一个数组,
第二个文件查看器N:
所以我想问用户,“你想添加多少条笔记”?我将此字符串存储为int。然后我想问用户“输入你的笔记”的次数与 int 一样多(你想添加多少笔记?)。
然后我想将用户的答案存储在一个数组中。字符串 numberNotes[] 数组,并在 infoView() 中打印出来。希望你能理解这一点!!谢谢
我想将用户在此处输入的注释打印为一个数组,我该怎么做?
感谢 public void infoView(){
System.out.println("\n\tYour notes:\n");
for(int ii = 0; userEnterADD >ii;ii++){
System.out.println(ii+1 + ". " + numberNotes[ii]);
//end for
}
}
// end of the program
}