java求救,在线等

liuchuancau 2014-12-03 10:21:45
1.Given the completed definition of the Course class above, complete the output produced
when the following section of code is executed:
Course c1 = new Course("CS", 101, 0, false);
System.out.println("1. " + c1.toString());
c1.setIsGenEd(true);
c1.setSemester(c1.getSemester() + 1);
System.out.println("2. " + c1.toString());

2.c) The program below contains the method printResult(). In the start() method make
one call to the printResult() method. Your call to the printResult() method must
compile.
public class MyProgram {
public void start() {
(3 marks)
}
private void printResult(int num, String letters,
boolean testType) {
String toLookFor = "" + num;
int position = letters.indexOf(toLookFor);
if (testType && position > -1) {
System.out.println("Correct!");
} else if (testType == false && position == -1) {
System.out.println("Correct!");
} else {
System.out.println("Not Correct!");
}
}
}


做完说明下原理,谢了
...全文
118 1 打赏 收藏 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
skgary 2014-12-04
  • 打赏
  • 举报
回复
关键部分都没,怎么做?

51,407

社区成员

发帖
与我相关
我的任务
社区描述
Java相关技术讨论
javaspring bootspring cloud 技术论坛(原bbs)
社区管理员
  • Java相关社区
  • 小虚竹
  • 谙忆
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧