java求救,在线等

liuchuancau liuchuancau 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
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!");
}
}
}


做完说明下原理,谢了
...全文

相关推荐

评论 1
收藏 已收藏
分享
返回顶部
liuchuancau
Java 51,407 成员 86,129 内容