File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark " Question" Watch " Question" New topic
Author Question

Harry Preston

Joined: Jun 01, 2013
Posts: 9
From JDK,

But AutoCloseable is located java.lang

How does Closeable know where to find AutoCloseable?
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33107

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.

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
Harry Preston

Joined: Jun 01, 2013
Posts: 9
Got it, thanks much
I agree. Here's the link:
subject: Question
It's not a secret anymore!