• Post Reply Bookmark Topic Watch Topic
  • New Topic

Closeable.java Question  RSS feed

 
Harry Preston
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
From JDK, Closeable.java

But AutoCloseable is located java.lang

Question
How does Closeable know where to find AutoCloseable?
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 36393
453
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Harry,
Good question! java.lang is a special package. It is automatically imported whether the class specifies it or not. Other common classes like Integer and String are located in that package as well. That's why you can just write Integer.parseInt("111") without having to import anything.
 
Harry Preston
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Got it, thanks much
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!