JAVA编程常见面试题及答案8
4723 点击·0 回帖
![]() | ![]() | |
![]() | 16.为了使以下java应用程序输出11、10、9,应在(**)处插入的语句是: i[a]=(int)x[a]+1; 如果要求输出10、9、8,则在(**)处插入的语句应是: i[a]=(int)x[a]; public class GetIt { public static void main(String args[]) { double x[] = {10.2, 9.1, 8.7}; int i[] = new int[3]; for(int a = 0;a < (x.length);a++) { (**) System.out.println(i[a]); } } } 17.阅读下列程序,分析程序的输出结果: My func abstract class Base{ abstract public void myfunc(); public void another(){ System.out.println(“Another method”); } } public class Abs extends Base{ public static void main(String argv[]){ Abs a = new Abs(); a.amethod(); } public void myfunc(){ System.out.println(“My func”); } public void amethod(){ myfunc(); } } | |
![]() | ![]() |