多选题Which statements about inheritance are true?()AIn Java programming language only allows single inheritance.BIn Java programming language allows a class to implement only one interface.CIn Java programming language a class cannot extend a class and impl

题目
多选题
Which statements about inheritance are true?()
A

In Java programming language only allows single inheritance.

B

In Java programming language allows a class to implement only one interface.

C

In Java programming language a class cannot extend a class and implement a interface together.

D

In Java programming language single inheritance makes code more reliable.

参考答案和解析
正确答案: A,C
解析: 在java中一个类只能有一个直接父类,但是可以实现多个接口,在继承的同时可以实现接口,之所以取消多继承的原因是多继承使得代码产生很多问题,而使用单一继承则可以使代码更可靠。
如果没有搜索结果或未解决您的问题,请直接 联系老师 获取答案。
相似问题和答案

第1题:

Structured programming practices(71)rise to Pascal,in which constructs were introduced to make programs more readable and better(72). C provided a combination of assembly language and high-level Structure to create a general-purpose language that could be used from system to(73)programming. Next came object orientation,which is(74)of a methodology and design philosophy than a language issue.This is(75)by the addition of so-called OO extensions to current languages,such as C.

A.giving

B.given

C.gave

D.gives


正确答案:C

第2题:

is not a programming language.

A.COBOL

B.Java.

C.UML

D.Basic


正确答案:C
解析:UML不是编程语言。

第3题:

● (75) is not a programming language.

(75) A.COBOL

B.Java

C.UML

D.Basic


正确答案:C
【解析】UML不是编程语言。

第4题:

Structured programming practices(71)rise to Pascal, in which constructs were introduced to make programs more readable and better(72)C provided a combination of assembly and high -level structure to create a general -purpose language that could be used from system to(73)programming. Next came object orientation, which is(74)of a metrology and design philosophy than a language issue. This is(75)by the addition of so - called OO extensions to current language, such as C++.

A.giving

B.given

C.gave

D.gives


正确答案:C

第5题:

Given a class whose instances, when found in a collection of objects, are sorted by using the compareTo()method, which two statements are true?()

A.The class implements java.lang.Comparable.

B.The class implements java.util.Comparator.

C.The interface used to implement sorting allows this class to define only one sort sequence.

D.The interface used to implement sorting allows this class to define many different sort sequences.


参考答案:A, C

第6题:

( 19 )阅读下列代码

public class Test2005{

public static void main(String args[]){

String s= ″ Test ″ ;

Switch(s){

case ″ Java ″ : System.out.print( ″ Java ″ ) ;

break ;

case ″ Language ″ : System.out.print( ″ Language ″ ) ;

break ;

case ″ Test ″ : System.out.print( ″ Test ″ ) ;

break ;

}

}

}

其运行结果是

A ) Java

B ) Language

C ) Test

D )编译出错


正确答案:C

第7题:

The standard class(17) in C + + language contain many useful classes for input and output, string handling, mathematical computations, and system programming tasks.

A.database

B.files

C.libraries

D.subroutine


正确答案:C
解析:C++语言的标准类库中有许多用于输入输出的、字符串处理、数学计算和系统调用的有用的类。

第8题:

阅读下列代码 public class Test 2005{ public static void main(String args[]){ Strings="Test"; switch(s){ case "Java":System.out.print("Java"); break; case "Language":System.out.print("Language"); break; case "Test":System.out.ptint("Test"); break; } } } 其运行结果是

A.Java

B.Language

C.Test

D.编译出错


正确答案:D
解析:程序中只有一个switch语句,因此本题考查switch语句的用法。switch语句是多分支语句,即根据表达式的值来执行多个操作中的一个。其一般格式为:
  switch(表达式){
   case value l:语句1;
     break;
   case value2:语句2;
     break;
   case value N:语句N;
     break;
  [default:语句N+1;]
  }
  在switch语句中,“表达式”的返回值类型必须是这几种类型之一:int,byte,char, short。本题中,switch的表达式s是一个字符串String类型的值,它不是血、byte、 char、short中的任意一个。因此表达式s的类型不对,编译时报错。因此,本题的正确答案是D。

第9题:

______ is not a programming language.

A.COBOL

B.Java

C.UML

D.Basic


正确答案:C
解析:译文的含义是:()不是一种编程语言。COBOL、Java和Basic都是编程语言,所以本题应该选择C。

第10题:

Which of the following statements about language is NOT true?

A.Language is a system
B.Language is symbol
C.Animals also have language
D.Language is arbitrary

答案:C
解析:
本题考查语言的定义。
本题要求选不正确的,C选项,动物也有语言,错误。语言是人类在交际中使用的一套任意的声音符号系统。动物没有语言,动物只是本能发出声音。综上,应选C。
A选项,系统的,故排除。
B选项,符号,故排除。
D选项,任意的,故排除。
故正确答案为C项。

更多相关问题