英文:
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<>
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论