【发布时间】:2015-02-10 16:04:30
【问题描述】:
老实说,这是我使用方法制作的首批程序之一,我希望在 B 修改部分得到一些帮助。我不明白我应该对方法中的参数使用什么语法,或者为什么我应该使用它。方法 showAll() 我已经做了,这是它的语法,但还没有走得太远,对此的任何帮助将不胜感激!
private static void showAll(String[] s, int i) { //there is an error with this
JOptionPane.showMessageDialog(null, "ShowAll");
System.out.println("Begin");
System.out.println("End");
}
showAll() 需要什么:
/** create a method named showAll() that:
* - returns no value
* - accepts 2 arguments **** (B modification)
* - an array of type String as an argument
* - a variable of type int to accept the iMax variable as an argument
* - contains
* - a MessageDialog that displays the message, "ShowAll"
* **** (B modification) comment out or delete
* more (B modification)
* - a loop that outputs all records from 0 to the max i populated
* - output statements before and after the loop designating begin and end of All
*/
其他相关语法: 案例陈述
switch(strArg) {
case "A":
strArg.equals("A");
addRec(strRecords, iMax);
loopQuery();
break;
case "F":
strArg.equals("F");
findRec(strRecords, iMax);
loopQuery();
break;
case "S":
strArg.equals("S");
showAll(strRecords, iMax);
loopQuery();
break;
default:
errMessage();
}
我真的只需要使方法类似于指示,如果有人能引导我走上那将不胜感激的道路! :D
【问题讨论】:
标签: java methods arguments switch-statement