当前位置: 答题翼 > 问答 > 大学本科 > 正文
目录: 标题| 题干| 答案| 搜索| 相关
问题

给出下面的代码: class Person{ String name department ; public void printValue(){ System.out.prin


给出下面的代码:

class Person{

String name,department ;

public void printValue(){

System.out.println("name is"+name);

System.out.println("department is "+department);

}

}

public class Teacher extends Person{

int salary;

public void printValue(){

//doing the same as in the parent method printValue()

//including print the value of name and department.

System.out.printin("salary is"+salary);

}

}

下面的______表达式可以加入printValue()方法的”doing the same as…”部分.

A.printValue(); B.this.printValue();

C.person.printValue();D.super.printValue();

参考答案
您可能感兴趣的试题
  • 下面的代码中有什么错误吗?_______ using System; class A { public virtual void F(){

  • 阅读下面的程序:public class Person{ int arr[ ]=Hew int[10]; public static void main(String

  • 请看代码,回答下面的问题。 Type TMammal=Class Procedure Walk; …..end;{end of TManmml} pro

  • 给出下面的代码: public class Person{ static int arr[] =n

  • 下面的代码:varperson={fname:Bill lname:Gates age:62};vartext=\;for(varxinperson){text+=person[x];}循环结束后 text的值为()

  • 给出下面代码: public class Person{ static int arr[] = new int[10];public static void