Hi i need two answers for this questions

Object Streams Lab

This is a simple assignment on writing an object to a file and reading it from the file. You are free to create your own object or use the following TwoPoint class with any necessary modification for creating instances of it that can be written to a file.

import java.io.*;

class TwoPoint {

private double x;

private double y;

public TwoPoint(double x, double y) {

this.x = x;

this.y = y;

}

public double getX() {

return x;

}

public double getY() {

return y;

}

public void setX(double x) {

this.x = x;

}

public void setY(double y) {

this.y =y;

}

public String toString() {

return "[TwoPoint:x=" + this.x + ", y=" + y +"]";

}

You should display the state of the object before writing to the file and also display the state after reading from the file.