Answer the question
In order to leave comments, you need to log in
Why is the object not serialized?
There is a class
public class LinkedListVector implements Vector, Serializable
{
private class Node
{
double value;
Node next, prev;
}
private Node beg;
private int size = 0;
private Node current = beg;
LinkedListVector(){...}
private Node getEl(int index) throws VectorIndexOutOfBoundsException{...}
public double get(int number) throws VectorIndexOutOfBoundsException{...}
public void get(int number, double value) throws VectorIndexOutOfBoundsException{...}
void add(double _value) {...}
void del(int index) throws VectorIndexOutOfBoundsException {...}
public void print(){...}
public int getLength(){...}
public double norma(){...}
}
LinkedListVector test = new LinkedListVector();
test.add(1);
test.add(2);
test.add(3);
test.add(4);
test.add(5);
FileOutputStream fos = new FileOutputStream(filePath);
ObjectOutputStream oos = new ObjectOutputStream(fos);
oos.writeObject(test);
oos.flush();
oos.close();
public class ArrayVector implements Vector, Serializable
{
private int length;
private double [] arr;
//и дальше идут методы
// ...
Answer the question
In order to leave comments, you need to log in
Learn to read stack traces. It directly says that the inner class of Node is not Serializable, although it should.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question