Java程序设计(华东交通大学)章节测试答案
2025年11月21日
在注释//Start For loop 处要插入哪段代码可以实现根据变量i的值定位访问数组ia[]的所有元素。public class Lin{ public void amethod(){ int ia[] = new int[4]; //Start For loop { ia[i]=i; System.out.println(ia[i]); } } } A.for (int i=0; i< ia.length;i++) B.for (int i=0; i< ia.length(); i++) C.for (int i=0; i < ia.length() -1; i++) D.for (int i=0; i< ia.length-1; i++)
在注释//Start For l...
2025年11月21日
设有如下程序:public class Test5 { public static void main (String args []) { /* This is the start of a comment if (true) { Test5 = new test5(); System.out.println(“Done the test”); } /* This is another comment */ System.out.println (“The end”); }}结果为? A.程序输出”Done the test”和 “The end” B.输出 “Done the test”. C. 程序输出”The end” D.程序编译错误.
设有如下程序:public cl...
2025年11月21日
如何能使程序调用Base类的构造方法输出”base constructor”;class Base{ Base(int i){ System.out.println(“base constructor”); } Base(){ }}public class Sup extends Base{ public static void main(String argv[]){ Sup s= new Sup(); //One } Sup() { //Two } public void derived() { //Three }} A.在//Two行之后放置super(10); B. 在//One行之后放置super(10); C.在//Three行之后放置super(10); D.在//One行之后放置Base(10);
如何能使程序调用Base类的构造...
2025年11月21日