public class Sphere extends Geometry { Vector3d center; double radius; public Sphere(Vector3d coords, double radius, String sphere_name, String material) { this.center = coords; this.radius = radius; shape_name = sphere_name; super.material = material; } public String toString() { StringBuilder result = new StringBuilder(); result.append("Radius: " + radius + "\t"); result.append("Center: " + center.toString() + "\t"); result.append(super.toString()); return result.toString(); } }
System.out.println("o3: " + o[3].toString());