可学答题网 > 问答 > Java程序设计题库,初级程序员题库
目录: 标题| 题干| 答案| 搜索| 相关
问题

现有: public class Pet() public class C


现有: public class Pet() public class Cat extends Pet{) 执行代码 Cat c- new Cat(); Pet p= (Pet)c; 后下列哪项是正确的?()

  • APetp=(Pet)c运行错误
  • BPetp=(Pet)c编译错误
  • CPetp=(Pet)c止常执行
  • D以上都不对
参考答案
参考解析:
分类:Java程序设计题库,初级程序员题库
相关推荐

1、现有: 1. class Wrench f 2.public static

现有:1. class Wrench f2.public static void main(String [] args) {3.Wrench w=new Wrench(); Wrench w2=new Wrench();4. w2=go (w, w2);5.System.out.pr...

2、现有: class TestApp{ public static void

现有:class TestApp{public static void main (String[] args){for (int i=0; iA0123B012456789C0123456789D012

3、现有:  public  class&ens

现有: public  class  TestDemo{    private int X-2;     static int y=3;&e...

4、现有:   public class&ens

现有:  public class Pet() public class Cat extends Pet{)     执行代码 Cat c-&ensp...

5、public class Pet{ &ens

public class Pet{    private String name;    public Pet(){ System.out.print(1); &ens...

6、现有: class TestApp{ public static void

现有:class TestApp{public static void main (String[] args){int [5] myarray={ 10, 11, 12, 13, 14);int sum=0;for (int x : myarray)sum+=x;System. ou...