Answer to Question #20635 in Java | JSP | JSF for nohra

Question #20635
To read objects from a file, we use the class _________________ .
A) InputObjectStream
B) ObjectInputStream
C) ObjectStream
D) ObjectInput
1
Expert's answer
2012-12-13T08:11:10-0500
To read objects from a file, we use the classObjectInputStream.

For example:
//this method reads object, that had been written to thefile //you should to know what type of object you will read.
//It necessary for casting read object to your typepublic Object read(File file) throwsException
{
FileInputStreamfis = new FileInputStream(file);
ObjectInputStreamoin = new ObjectInputStream(fis);
return (Object)oin.readObject();
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS