JAVA练习题(第3章).ppt

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

29、第十行的声明将调用哪些方法.( ) 1 class Person { 2 public void printValue(int i, int j) { } 3 public void printValue(int i){ } 4 } 5 public class Teacher extends Person { 6 public void printValue() { } 7 public void printValue(int i) {} 8 public static void main(String args[]){ 9 Person t = new Teacher(); 10 t.printValue(10); 11 } 12 } A .第2行的方法 B. 第3行的方法 C. 第6行的方法 D. 第7行的方法 18、class A{ private int privateVar; A(int _privateVar){ ?????? privateVar=_privateVar;    }    boolean isEqualTo(A anotherA){     if(this.privateVar == anotherA.privateVar)     return true;     else     return false;    } ?? } public class B{ public static void main(String args[]){ A a = new A(1); A b = new A(2); System.out.println(a.isEqualTo(b));    } ?? } 19、class A { ?? double f(double x, double y) { ?? return x * y; ?? } ?? } ?? class B extends A { ?? double f(double x, double y) { ?? return x + y; ?? } ?? } ?? public class Test { ?? public static void main(String args[]) { ?? B obj = new B(); ?? System.out.println(The program output is + obj.f(4, 6)); ?? } ?? } 20、public class Test { void printValue(int m){ do { System.out.println(The value is+m); }while( --m 10 ); } public static void main(String arg[]) { int i=10; Test t= new Test(); t.printValue(i); } } 21、class Parent { String one, two; public Parent(String a, String b){ one = a; two = b;} public void print(){ System.out.println(one); } } public class Child extends Parent { public Child(String a, String b){ super(a,b); } public void print(){ System.out.println(one + to + two); } public static void main(String args[]){ Parent p = new Parent(south, north); Parent t = new Child(east, west); p.print(); t.print();} } 22、public class A { public static void main (String[] args) { A a=new B( ); a.test(); } void test() {

文档评论(0)

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

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

1亿VIP精品文档

相关文档