第三章java类试题.docxVIP

  • 23
  • 0
  • 约2.55千字
  • 约 4页
  • 2018-01-10 发布于河南
  • 举报
第三章java类试题

七、类与对象编程1) 以下程序的运行结果为:public class My{ int value; public static void main(String args[]) { My x=new My(); if (x==null) System.out.println(No Object); else System.out.println(x.value); }}A. 0 B. 1 C. No Object D. 编译错误 E. null(2)以下程序的运行结果为:public class A { static int k=3; 静态变量 类变量 public static void main(String[] args) { int k=4; A x1=new A(); x1.k++; 4 A x2=new A(); x2.k++; 5 k++; System.out.println(x1.k); }} A. 3 B. 4 C.5 D.6 E.73) 编译和运行以下程序结果为:public class A { static int k=3; static int m; public static void main(String[] args) { k++; 4 if (m==0) System.o

文档评论(0)

1亿VIP精品文档

相关文档