• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Java 8 exam - which classes implement Closeable?

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I know that IO classes implement the Closeable interface, and I agree that learning things for an exam isn't the best way to go, but I'm curious: is there a list of classes in Java 8 that implement Closeable?

Am I going to have to go into the exam knowing just those that I've looked at in the OCP book by Oracle?
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Anupam,
Welcome to CodeRanch!

The JavaDoc lists the Java 8 classes that come with the JDK that implement Closable. Luckily, you don't need to know most of them for the exam!The study guides distill what you need to know for the exam.

Also, the JDBC classes like ResultSet implement AutoCloseable. There's a list for that too.
 
Anupam Banerji
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks very much Jeanne!  Loved your book, by the way!

This reminds me to check the Javadoc before I post elementary questions...
 
Bartender
Posts: 3903
43
  • Likes 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Anupam Banerji wrote:Hi, I know that IO classes implement the Closeable interface, and I agree that learning things for an exam isn't the best way to go, but I'm curious: is there a list of classes in Java 8 that implement Closeable?

Am I going to have to go into the exam knowing just those that I've looked at in the OCP book by Oracle?



First off, you probably need AutoCloseable, not Closeable

Next, open Eclipse, Shift + Ctrl + T type AutoCloseable

Then F4

Enjoy the list (see attached)





2.png
[Thumbnail for 2.png]
AutoCloseable hierarchy
 
Anupam Banerji
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@Mikalai Zaikin:  Fantastic!  Thanks very much!
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic