Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
bgColor#FFcccc
public class Point {

 private double x;
 private double y;

 public Point(double x, double y) {
  this.x = x;
  this.y = y;
 }
 
 public Point()
 {
  //no argument constructor
 } 
}

import java.io.Serializable;
import java.io.FileOutputStream;
import java.io.ObjectOutputStream;

public class Coordinates extends Point implements Serializable {

 public static void main(String[] args)
 {
  try {
   Point p = new Point(5,2);
   FileOutputStream fout = new FileOutputStream("point.ser");
   ObjectOutputStream oout = new ObjectOutputStream(fout);
   oout.writeObject(p);
   oout.close();
  }
  catch (Exception e) {System.err.println(e);} 
 }
}

...