• Post Reply Bookmark Topic Watch Topic
  • New Topic

MyFile.print() Question  RSS feed

 
Sam Bluesman
Ranch Hand
Posts: 191
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have two class files, a.java and b.java (note these are just references for easy reading).

Now, a.java does most of the work but calls on b.java to take in data, process it, and RETURN it back to a.java so it can then carry on running.

I have succesfully managed to print each stage of the algorithm in a.java and am trying to also, in the same output text file, print out what is going on in b.java. However, I keep getting

throws IOException must be declared;

errors when trying to implement a MyFile.print (MyFile being the instance i have called the output file) on something in b.java. It appears everytime at the lines where i am invoking b.java in a.java with data i want b.java to process, and am not sure where to put the throws IOException.

Any ideas?

Cheers
[ March 06, 2006: Message edited by: Sam Bluesman ]
 
Jeremy Tartaglia
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The throws keyword is a way to define a method so that the compiler knows it will not handle a specific exception or even multiple exceptions. Using it is quite easy:



No guarrantees on the above code, but it's a similar process.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!