可学答题网 > 问答 > SCJP程序员认证考试题库
目录: 标题| 题干| 答案| 搜索| 相关
问题

public class Car {&ens


public class Car {  private int wheelCount;  private String vin;  public Car(String vin) {  this.vin = vin;  this.wheelCount = 4;  }  public String drive() {  return “zoom-zoom”;  }  public String getInfo() {  return “VIN: “+ vin + “wheels: “+ wheelCount;  }  }  And:  public class MeGo extends Car {  public MeGo(String vin) {  this.wheelCount = 3;  }  }  What two must the programmer do to correct the compilation errors?()

  • A insert a call to this() in the Car constructor
  • B insert a call to this() in the MeGo constructor
  • C insert a call to super() in the MeGo constructor
  • D insert a call to super(vin) in the MeGo constructor
  • E change the wheelCount variable in Car to protected
  • F change line 3 in the MeGo class to super.wheelCount = 3;
参考答案
参考解析:
分类:SCJP程序员认证考试题库
相关推荐

1、public class test( &en

public class test(   public int aMethod()[  static int i=0;  i++;  return I;&en...

2、Public class test (&en

Public class test ( Public static void stringReplace (String text)  ( Text = text.replace&e...

3、class One {  public&en

class One { public One() { System.out.print(1); } } class Two extends One { public Tw...

4、public class foo {&ens

public class foo { public static void main (string[]args) try {return;} finally {system.out.printIn(F...

5、public class Test {&en

public class Test { public static void main(String [] args) { System.out.println(args.length > 4&...

6、public class Foo {&ens

public class Foo { public void main (String [] args)   { system.out.printIn(Hello World.);...