in java programming language Question(30 points): class Worker implements Serial
ID: 3713124 • Letter: I
Question
in java programming language
Explanation / Answer
public static int numOfObject(String s1) throws IOException, ClassNotFoundException {
FileInputStream fin = new FileInputStream(s1);
ObjectInputStream ois = new ObjectInputStream(fin);
int count = 0;
try {
while (true) {
ois.readObject();
}
} catch (OptionalDataException e) {
if (!e.eof) throw e;
} finally {
ois.close();
}
return count;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.