你能在java.util包提供的接口中找到方法定义。

huangapple go评论73阅读模式
英文:

Where can we find the definition of methods present in the interfaces given by java.util package

问题

Java不允许在接口中定义方法(直到1.7版本),但例如在List<>接口中,存在诸如size()contains()isEmpty()等方法。我想知道它们的定义在哪里。由于它是一个接口,在我们的类中使用时,我们需要定义这些方法。所以有人可以告诉我它们在哪里被定义了吗?

英文:

java doesn't allow definition of methods in interface (until 1.7) but for example in List&lt;&gt; interface there are methods such as size(), conatins(), isEmpty(). I wonder where is its definition. Since it is an interface we need to define these methods while we use it in our class. So can anyone tell me where is it defined?

答案1

得分: 0

有几个具体类在java.util包中实现了List接口。查看List的javadoc会在“已知的所有实现类”标题下列出其中一些。您会在那里找到这些实现。

英文:

There are several concrete classes that implement the List interface in the java.util package. Looking at List's javadoc lists a few of them under the "All Known Implementing Classes" heading. You'll find the implementations there.

huangapple
  • 本文由 发表于 2020年9月1日 21:05:31
  • 转载请务必保留本文链接:https://go.coder-hub.com/63688293.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定