1. 1、本文档共10页,可阅读全部内容。
  2. 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
  3. 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  4. 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
Java习题二

指出下列程序的运行结果 public class Example {   String str=new String(good);   char[]ch={a,b,c};   public static void main(String args[]) {     Example ex=new Example();     ex.change(ex.str,ex.ch);     System.out.print(ex.str+ and );     Sytem.out.print(ex.ch);   }   public void change(String str, char ch[]) {     str=test ok;     ch[0]=g;   } } 传值和传地址 ① good and abc ② good and gbc ③ test ok and abc ④ test ok and gbc 2. 给出下面代码: public class Person {   static int arr[] = new int[10];   public static void main(String a[])   {    System.out.println(arr[1]);   } } 哪个语句是正确的? ① 编译时将产生错误; ② 编译时正确,运行时将产生错误; ③ 输出零; ④ 输出空。 3.下列哪些语句关于内存回收的说明是正确的? ① 程序员必须创建一个线程来释放内存; ② 内存回收程序负责释放无用内存 ③ 内存回收程序允许程序员直接释放内存 ④ 内存回收程序可以在指定的时间释放内存对象 4.1) public void modify() { 2) int I, j, k; 3) I = 100; 4) while ( I 0 ) { 5) j = I * 2; 6) System.out.println ( The value of j is + j ); 7) k = k + 1; 8) I--; 9) } 10) } ① line 4 ② line 6 ③ line 7 局部变量必须初始化,成员变量不需初始化,数组不需初始化 ④ line 8 5.指出下列哪些方法与方法public void add(int a){}为合理的重载方法。 ① public int add(int a) ② public void add(long a) ③ public void add(int a,int b) ④ public void add(float a) 6.给出下面代码段   1) public class Test {   2) int m, n;   3) public Test() {}   4) public Test(int a) { m=a; }   5) public static void main(String arg[]) {   6) Test t1,t2;   7) int j,k; 8) j=0; k=0;   9) t1=new Test();   10) t2=new Test(j,k);   11) }   12) }   哪行将引起一个编译时错误? ine 3 line 5 line 6 line 10 7.main()方法的返回类型是: ① int ② void ③ Boolean ④ static 8.System类在哪个包中? java.util java.io java.awt java.lang 9.给出下面代码: public class Test {     static int a[] = new a[10]; public static void main(String args[]) {      System.out.println(a[10]);     }   } 那个选项是正确的? ① 译时将产生错误; ② 编译时正确,运行时将产生错误; ③ 输出零; ④ 输出空。 10.String s = hello;   String t = hello;   char c[] = {h,e,l,l,o} ; 下列哪些表达式返回true? s.equals(t);t t.equals(c);f s==t;t t.equals(new String(hello));t 11.下述哪些说法是正确的? 实例变量是类的成员变量 实例变量是用static关键字声

文档评论(0)

wuailuo + 关注
实名认证
内容提供者

该用户很懒,什么也没介绍

1亿VIP精品文档

相关文档