File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Closeable.java Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Closeable.java Question" Watch "Closeable.java Question" New topic
Author

Closeable.java Question

Harry Preston
Greenhorn

Joined: Jun 01, 2013
Posts: 9
From JDK, Closeable.java

But AutoCloseable is located java.lang

Question
How does Closeable know where to find AutoCloseable?
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 29219
    
134

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.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Harry Preston
Greenhorn

Joined: Jun 01, 2013
Posts: 9
Got it, thanks much
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Closeable.java Question
 
Similar Threads
try-with-resources
ioexception
About File close question
what operation does inputStream.close() does?
Closing Database Resources