Win a copy of Android Programming: The Big Nerd Ranch Guide this week in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Java 8 exam - which classes implement Closeable?  RSS feed

 
Anupam Banerji
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • 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?
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 36875
481
Eclipse IDE Java VI Editor
  • Likes 1
  • Mark post as helpful
  • send pies
  • 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: 5
  • Mark post as helpful
  • send pies
  • 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...
 
Mikalai Zaikin
Ranch Hand
Posts: 3404
16
  • Likes 4
  • Mark post as helpful
  • send pies
  • 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: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Mikalai Zaikin:  Fantastic!  Thanks very much!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!