On Wed, 07 May 2008 20:34:55 +0000, thufir wrote:
> Working from the Sun tutorial, to a degree. How can I combine tryIt()
> and scanXan() into one method? Of course, it's silly to pass the
> String, but what I mean is the try/catch and exception handling:
Oh, it was because I had the method itself throwing an exception!
It at least compiles and runs, but is it "ok"?
thufir@[EMAIL PROTECTED]
thufir@[EMAIL PROTECTED]
cat src/a00720398/util/
DataException.java
package a00720398.util;
im****t a00720398.data.*;
im****t a00720398.util.*;
im****t a00720398.labs.*;
im****t java.util.*;
im****t java.io.*;
public abstract class DataException {
public static void scanXan() {
Scanner s = null;
try {
s = new Scanner(new BufferedReader(new FileReader
("guests.txt")));
while (s.hasNext()) {
System.out.println(s.next());
}
} catch (IOException e) {
System.out.println(e.getMessage());
e.printStackTrace();
} finally {
if (s != null) {
s.close();
}
}
}
}
thufir@[EMAIL PROTECTED]
thanks,
Thufir


|