【发布时间】:2017-05-20 12:03:21
【问题描述】:
我有一个 Java 数组(基于控制台),我想在用户输入时打印出存储在其中一个位置的详细信息。例如,他们在控制台应用程序中输入“3”,然后程序以匹配请求的详细信息进行响应。
提前致谢!
if(input.matches("S")){
// If user input matches with S, then the user willSSN be asked to enter a array position and then the corresponding information will be shown
KeyStroke[] patientsDetails = new KeyStroke[5];
patientsDetails[0] = new KeyStroke(9,"OX5BJM","Peter",2039489);
patientsDetails[1] = new KeyStroke(12,"OX1BOL","Kim",2434587);
patientsDetails[2] = new KeyStroke(67,"OX2VBN","Patrick",2233842);
patientsDetails[3] = new KeyStroke(34,"OX2XHB","Liam",2432340);
patientsDetails[4] = new KeyStroke(54,"OX3BUN","Bob",2234098);
System.out.println("Enter an array postion from 0 to 4 to show paitients corresponding postion and details");
number1 = enterNumber0.nextInt();
if (input.matches("0")){
System.out.println(patientsDetails[0]);
}
【问题讨论】:
-
它是程序的一部分。不确定向我的工作提出特定问题有什么问题?
-
这是一个非常基本的问题,表明没有努力学习或研究
标签: java arrays netbeans printing console