Welcome to Dream.In.Code
Become a Java Expert!

Join 150,422 Java Programmers for FREE! Get instant access to thousands of Java experts, tutorials, code snippets, and more! There are 1,104 people online right now. Registration is fast and FREE... Join Now!




Scanner class throwing a question

 
Reply to this topicStart new topic

Scanner class throwing a question

kyleryansmith@hotmail.com
18 Mar, 2008 - 01:13 AM
Post #1

New D.I.C Head
*

Joined: 31 Jan, 2008
Posts: 23


My Contributions
Hey there guys, i am having a problem. I am using the scanner class and i need to know what exception is thrown if a the name of the file is incorrect or is in the wrong folder?

a example of a code will be
CODE

Scanner scFile = new Scanner (new File ("data.txt"));





User is offlineProfile CardPM
+Quote Post

KYA
RE: Scanner Class Throwing A Question
18 Mar, 2008 - 04:07 AM
Post #2

#include <nerd.h>
Group Icon

Joined: 14 Sep, 2007
Posts: 5,954



Thanked: 160 times
Dream Kudos: 1375
My Contributions
I would have it run incorrectly to see what it is, if that's too much work try this:

http://java.sun.com/j2se/1.5.0/docs/api/ja...il/Scanner.html

From above link:

Scanner

public Scanner(File source,
String charsetName)
throws FileNotFoundException

Constructs a new Scanner that produces values scanned from the specified file. Bytes from the file are converted into characters using the specified charset.

Parameters:
source - A file to be scanned
charsetName - The encoding type used to convert bytes from the file into characters to be scanned
Throws:
FileNotFoundException - if source is not found
IllegalArgumentException - if the specified encoding is not found

I don't want to sound rude, but damn...this isn't that hard to find; its laziness
User is online!Profile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/9/09 08:26PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Java Help!

Java Tutorials

Reference Sheets

Java Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month