首页题目详情

以下哪项是接口的正确定义方式?

题目配图
A.interface MyInterface { void method(); }
B.class MyInterface implements interface { void method(); }
C.interface MyInterface extends class { void method(); }
D.class MyInterface { void method(); }

优质解答

答案

A

解析

在Java中,接口使用关键字interface定义,不能继承类,只能继承其他接口。正确的定义是A。

查看答案和解析

支付 ¥0.1 即可查看此题答案和详细解析

低至 ¥0.1 起

Java语言程序设计单选题中等AI生成