abstract class GraphicObject { abstract double area(); } class Circle extends GraphicObject { double raza; double area() { return

3.14*raza*raza; } } class Rectangle extends GraphicObject { double lungime, latime; double area() { return lungime*latime; } } class UseGraphicObject { public static void main(String args[]) { Circle c=new Circle(); c.raza=3; System.out.println("Aria cercului este: " + (c.area())); Rectangle r=new Rectangle(); r.lungime=4; r.latime=5; System.out.println("Aria dreptunghiului este: " + (r.area())); } }

Sign up to vote on this title
UsefulNot useful

Master Your Semester with Scribd & The New York Times

Special offer for students: Only $4.99/month.

Master Your Semester with a Special Offer from Scribd & The New York Times

Cancel anytime.