I need to write a program that gets inputted files from arguments written from command prompt and prints a random line from it. I don't really know how many exceptions i need and I don't really understand the logic of getting the line from the file. Please help me.

Recommended Answers

All 2 Replies

I don't really know how many exceptions i need

if you want to have a minimum, just put everything in one HUUUGE try-catch block, catching a standard Exception.

otherwise, just write the code you think you'll need, try to compile it and you should get messages like:

unhandled ...Exception at line ...

that should give you an idea of what Exception to handle with, and, more important, about where to do so

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.