[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"$fwyu-Xllwt9R2Oct1hZX2DGFynY84rJFee2JBfJ0OwHU":3},{"answer":4,"createTime":5,"id":6,"options":7,"origin":8,"question":15,"related":16,"source":27,"type":87},[],"2026-04-23 06:38:20",148306627,[],{"count":9,"courseId":10,"courseImg":11,"courseName":12,"workId":13,"workName":14},10,"53e1d2ef4961cca8eea3e23969ad2cb9","https:\u002F\u002Ftihai-oss-cloud.itihey.com\u002Fimg\u002F03a579384a6dc297c89809b582fcc767.png","默认课程","71ae1d8e8cb946ab89914e708b850a39","第5章 继承与多态","请阅读下面程序,并写出运行结果.class Base{ public int getX() { return 1; } public static int getY() { return 2; }}class Sub extends Base{ public int getX() { return 3; } public static int getY() { return 4; }}public class Demo { public static void main(String[] args) { Sub sub=new Sub(); Base base=(Base) sub; int a=sub.getX()*base.getX(); int b=sub.getY()+base.getY(); System.out.println(a+b); }}",[17,29,38,47,56,65,74,84,88,93],{"answer":18,"createTime":19,"id":20,"options":21,"question":26,"source":27,"type":28},[],"2024-06-03 16:53:41",148306610,[22,23,24,25],"B x = new B( )","B x = new C( )","C x = new C( )","C x = new B( )","已知类B是类C的父类,则不正确的语句是( )","v1",0,{"answer":30,"createTime":19,"id":31,"options":32,"question":37,"source":27,"type":28},[],148306611,[33,34,35,36],"子类不能继承父类的私有成员变量和成员方法","子类能继承父类的非私有成员变量和成员方法","子类只能继承父类public成员变量和成员方法","子类只能继承父类的成员方法,而不继承成员变量","关于继承的说法,正确的是( )",{"answer":39,"createTime":19,"id":40,"options":41,"question":46,"source":27,"type":28},[],148306612,[42,43,44,45],"public float getNum() { return 4.0f; }","public double getNum(float d) { return 3.0f;}","public void getNum(double d) { }","public void getNum() { }","有如下程序,在下划线处添加( )方法,编译时会产生错误. class Good{ public float getNum(){ return 2.0f; }} public class Better extends Good { ________________ }",{"answer":48,"createTime":19,"id":49,"options":50,"question":55,"source":27,"type":28},[],148306613,[51,52,53,54],"equals()","clone()","toString()","hashCode()","覆写Object中的( )方法使对象能够返回有价值的信息",{"answer":57,"createTime":19,"id":58,"options":59,"question":64,"source":27,"type":28},[],148306614,[60,61,62,63],"Base Obj = new Derived( )","Derived Obj = new Base( )","Base Obj = new Base( )","Derived Obj = new Derived( )","Derived类是Base类的子类,下面( )语句是错误的",{"answer":66,"createTime":19,"id":67,"options":68,"question":73,"source":27,"type":28},[],148306615,[69,70,71,72],"print( )","super.print( )","super.super.print( )","new C( ).print( )","定义了如下的A、B和C类,则( )语句在划线处能正确调用类C中的print( )方法.class C{ void print() {}}class B extends C{ void print() { }}class A extends B{ void print() { } void show() { ________ }}",{"answer":75,"createTime":19,"id":76,"options":77,"question":82,"source":27,"type":83},[],148306616,[78,79,80,81],"如果修饰成员变量,则一旦赋了值,就等同一个常量","如果修饰类,则该类只能被一个子类继承","如果修饰成员方法,则该方法不能在子类中被重写","如果修饰成员方法,则该方法所在的类不能被继承","关于final关键字的说法,正确的是( )",1,{"answer":85,"createTime":5,"id":6,"options":86,"question":15,"source":27,"type":87},[],[],9,{"answer":89,"createTime":5,"id":90,"options":91,"question":92,"source":27,"type":87},[],148306628,[],"请阅读程序,写出程序运行结果.class Eye { \u002F\u002F 猫的眼睛类 private String color; public Eye(String color) { this.color = color; }}class Cat { \u002F\u002F 猫类 private String name; private Eye eye; public Cat(String name, Eye eye) { this.name = name; this.eye = eye; } public boolean equals(Object obj) { Cat cat = (Cat) obj; if (this.name.equals(cat.name) &amp;&amp; this.eye == cat.eye) return true; return false; }} public class CatDemo { public static void main(String[] args) { Eye e1=new Eye(&quot;蓝色&quot;); Eye e2=new Eye(&quot;蓝色&quot;); Cat tom=new Cat(&quot;Tome&quot;,e1); Cat jack=new Cat(&quot;Jack&quot;,e2); System.out.println(tom==jack); System.out.println(tom.equals(jack)); }}",{"answer":94,"createTime":5,"id":95,"options":96,"question":97,"source":27,"type":87},[],148306629,[],"请阅读程序,并写出程序运行结果.class X{ int getX() { return 5; }}class Y extends X{ int getX() { return 6; }}class T extends X{ int getX() { return 7; }}public class Demo10 { public static void main(String[] args) { X x=new X(); Y y=new Y(); X t=new T(); int sum=x.getX()+y.getX()+t.getX(); System.out.println(sum); }}"]