摘要: 1. Draw the control flow graph for the printPrime() method. ans: 2.Consider test cases ti = (n = 3) and t2 = ( n = 5). Although these tour the same pr 阅读全文
posted @ 2018-03-25 21:38 YADKAR 阅读(452) 评论(0) 推荐(0)
摘要: Primes.java 1 package findPrimes; 2 3 public class Primes { 4 5 private final static int MAXPRIMES = 100; 6 7 private boolean isDvisible(int a, int b) 阅读全文
posted @ 2018-03-25 21:38 YADKAR 阅读(635) 评论(0) 推荐(0)
摘要: 对于Junit和hamcrest的安装,使用了eclipse自动导入的Junit4包(因为实验要求Junit以及hamcrest版本正好和eclipse氧气中自动导入的包版本一样),具体步骤如下: 鼠标右键点击工程->点击Properties->Java Build Path->Libraries- 阅读全文
posted @ 2018-03-25 21:35 YADKAR 阅读(550) 评论(0) 推荐(0)
摘要: 题目一:1.Fault: 循环条件没设置好,i > 0会导致循环无法进行到数组第一项,应该改成 i >= 0。2.数组x为空时,会抛出空指针错误,循环无法执行,也不会执行上面叙述的Fault。3.只要满足数组x[0]不是与y相等的唯一的元素即可避免Error,比如测试用例 x = [1, 2, 3, 阅读全文
posted @ 2018-03-14 19:37 YADKAR 阅读(334) 评论(0) 推荐(0)
摘要: Java 代码正尝试将对象转换到一个错误的类型。 阅读全文
posted @ 2018-03-12 21:13 YADKAR 阅读(255) 评论(0) 推荐(0)