单选题 现有: class Cat { Cat (int c) {System.out.print ("cat"+c+" "); } } class SubCat extends Cat { SubCat (int c){super (5); System.out.print ("cable");} . SubCat() { this (4); } public static void main (String [] args) { SubCat s= new SubCat();//调用无参的 } } 结果为:
相关试题
单选题 假设People类有如下定义,设p是People类的一个实例,下列语句调用哪个是错误的? 答案( ) public class People{ int i; static String s; void imethod() { } static void smethod() { }}
单选题 若int[] a = {12,43,54,23},则a[3]的值是( )
单选题 class Line{ private int x,y; public Line(int x,int y){ this.x=x; this.y=y; }}其中this代表( )
单选题 java实现动态多态性是通过( )实现的。
单选题 下列【1】【2】【3】【4】注释标注的哪行代码有错误?( )import java.util.*; public class E { public static void main(String args[]) { List<Integer> linkedList = new LinkedList<Integer>(); //【1】 List<Integer> arryList = new ArrayList<Integer>(); //【2】 Set<Integer> hashSet = new HashSet<Integer>(); //【3】 List<Integer> set = new TreeSet<Integer>(); //【4】 } }
单选题 程序: public class Pet{ public void speak(){ System.out.print("Pet"); } } public class Cat extends Pet{ public void speak(){ System.out.print("Cat"); } } public class Dog extends Pet{ public void speak(){ System.out.print("Dog"); } } 执行代码 Pet[] p= {new Cat (),new Dog(),new Pet()}; for (int i=0;i
单选题 下面程序运行的结果是( ) public static void main(String[] args){ int a = 1; if(a < 1){ System.out.println(a); }else{ System.out.println(“a”); } }
单选题 下列有关线程的两种创建方式说法错误的是( )