父类和子类定义如下: class FatherClass { public FatherClass() { System.out.println("FatherClass Create"); } } class ChildClass extends FatherClass { public ChildClass() { System.out.println("ChildClass Create"); } public static void main(String[] args) { FatherClass fc = new FatherClass(); ChildClass cc = new ChildClass(); } }请问输出结果为:
举一反三
- 父类和子类定义如下: class FatherClass { public Fa...Class(); } }请问输出结果为:
- 中国大学MOOC: 下列代码中构造方法的返回类型是()public class Village { Village () { System .out .println(“hiding in Village”) ; } public static void main( String args [ ]) { Village c =new Village ( ) ;}class Village { public static void main( String args [ ]) { Village c =new Village ( ) ; } Village () { System .out .println(“hiding in Village”) ; } }
- 以下程序正确的输出是()package test;public class ...ew ChildClass();}}
- class Animal { public Animal() { System.out.println("Animal!"); } } public class Dog extends Animal{ public Dog() { System.out.println("Dog!"); } public static void main(String[] args) { Dog dog=new Dog(); } }
- 给定Java代码如下所示,则编译运行后,输出结果是。 class Parent { public void count() { System.out.println(10%3); } } public class Child extends Parent{ public void count() { System.out.println(10/3); } public static void main(String args[]) { Parent p = new Child(); p.count(); } }