What will be the output of the following program?
import java.io.*;
public class Draw {
public static void main(String str[]) {
try {
Square sq = new Square(10);
Circle ci = new Circle(7);
sq.drawShape(); ci.drawShape();
ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("shapes.txt"));
oos.writeObject(sq); oos.writeObject(ci);
oos.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
abstract class DrawObject {
public abstract void drawShape();
}
class Square extends DrawObject {
private final int x;
public Square(int x) {
this.x = x;
}
public void drawShape() {
System.out.println("The side of a square is : " + x);
}
}
class Circle extends DrawObject {
private final int rad;
public Circle(int rad) {
this.rad = rad;
}
public void drawShape() {
System.out.println("The radius of a circle is : " + rad);
}
}