Fred Hamilton wrote:In addition to having the method throw the exception as you have done here, you should also learn about the try/catch method of handling exceptions.
Anyways, in this case it's all about how the program is supposed to react if the filename you specify in the program doesn't actually exist. You have to tell the program how to react to that situation.
probably you would benefit from some study of the concept of exception handling in java, you will encounter it a lot.
The Java Tutorial does a pretty good job, but there's plenty of other sources too.
http://java.sun.com/docs/books/tutorial/essential/exceptions/index.html
Yep you are right,
I will study on them,
Another question,
Look at this program.
Out put is
ENTER ROLL NO 1: 12
ENTER NAME1: ENTER NAME2: myName
NAME 1 IS:
NAME 2 IS: myName
any idea why it is behaving like that, i mean why it combines two statements together and is getting only one input!
(ENTER NAME1: ENTER NAME2:) instead of this it has to show like this
ENTER NAME1:name1
ENTER NAME2:name2
if i am writing statement like this it works but not exceptiong spaces
name1=input.next();
name2=input.next();
is it possible to accept spaces and get inputs?