Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Beginning Java and the fly likes throws Java.io.IOException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "throws Java.io.IOException" Watch "throws Java.io.IOException" New topic
Author

throws Java.io.IOException

Harry Jones
Greenhorn

Joined: Mar 19, 2010
Posts: 20
Are these two statements the same, or is one better than the other?


Thanks.
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14114
    
  16

They are the same.

If you just use "IOException" instead of "java.io.IOException", you will have to put an import statement at the top of your source file:

import java.io.IOException;

Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
 
jQuery in Action, 2nd edition
 
subject: throws Java.io.IOException