hi.
I'm trying to print an object to a file using:
FileOutputStream fos = new FileOutputStream("client.tmp"
ObjectOutputStream put = new ObjectOutputStream(fos);
then calling a method writeObject()
put.writeObject(customer1);
However, I keep getting errors either saying that I have to declare exceptions which will be thrown, which I dont understand because both of the above instances are attributes and I dont know how to inicate that they will throw exceptions, except through the method specification.
When I can get it to compile by making the instances inside the method, the program runs until it comes to writing the file, then a load of NotSerializableExceptions pop up.
To remedy this I have added ' import java.io.Serializable ' to class Client is the class of the instance 'customer1' I am trying to write to file, to make it a serializable instance....but still get the same errors.
Pllllllllleeeeeeeeeeeaaaseee, if anyone knows of a way I'd be very grateful! preferably if you could tell me what I'm doing wrong so I can learn, t'd b good!!
cheers every1!!!!!
JoE
we are all of us living in the gutter.
But some of us are looking at the stars.
I'm trying to print an object to a file using:
FileOutputStream fos = new FileOutputStream("client.tmp"
ObjectOutputStream put = new ObjectOutputStream(fos);
then calling a method writeObject()
put.writeObject(customer1);
However, I keep getting errors either saying that I have to declare exceptions which will be thrown, which I dont understand because both of the above instances are attributes and I dont know how to inicate that they will throw exceptions, except through the method specification.
When I can get it to compile by making the instances inside the method, the program runs until it comes to writing the file, then a load of NotSerializableExceptions pop up.
To remedy this I have added ' import java.io.Serializable ' to class Client is the class of the instance 'customer1' I am trying to write to file, to make it a serializable instance....but still get the same errors.
Pllllllllleeeeeeeeeeeaaaseee, if anyone knows of a way I'd be very grateful! preferably if you could tell me what I'm doing wrong so I can learn, t'd b good!!
cheers every1!!!!!
JoE
we are all of us living in the gutter.
But some of us are looking at the stars.