java题库 下载本文

System.out.println(\ }

public static void main(String argv[]){ Abs a = new Abs(); } }

10. 编译并运行下面程序,分析结果(继承,最终方法,无错) class Base{

public final void amethod(){

System.out.println(\ } }

public class Fin extends Base{

public static void main(String argv[]){ Base b = new Base(); b.amethod(); } }

11. 编译并运行下面程序,分析结果(最终方法不能被覆盖重写) class Base{

public final void amethod(){

System.out.println(\ } }

public class Fin extends Base{

public void amethod(){

System.out.println(\ }

public static void main(String argv[]){ Base b = new Base(); b.amethod(); }

12. 编译并运行下面程序,分析结果(构造方法为私有访问权限,只有该类有主方法时才能

运行, 此题没错,输入1至9) public class Hope{

public static void main(String argv[]){ Hope h = new Hope(); }

private Hope(){ for(int i =0; i <10; i ++){

System.out.println(i); }

} }

13. 编译并运行下面程序,分析结果( 主方法参数为字符串数组,而不是字符串) public class MyMain{

public static void main(String argv){

System.out.println(\ } }

14. 编译并运行下面程序,分析结果(类的访问权限不能为private) private class Base{} public class Vis{

transient int iVal;

public static void main(String elephant[]){ } }

15. 编译并运行下面程序,分析结果(数组下标越界) public class MyAr{

public static void main(String argv[]){ int[] i = new int[5];

System.out.println(i[5]); } }

16. 编译并运行下面程序,分析结果(静态方法不能访问非静态数据) public class Arg{

String[] MyArg;

public static void main(String argv[]){ MyArg=argv; }

public void amethod(){

System.out.println(argv[1]); } }

17. 编译并运行下面程序,分析结果(字符比较:==是比较地址) public class StrEq{