viewing paste Unknown #10016 | Java

Posted on the
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
public class MouthKiss 
{
        public static void main (String[] args)
        {
                ArrayList<Shape> shapes = new ArrayList<Shape>();
                shapes.add(new Square(10));
                shapes.add(new Rectangle(5, 5));
                shapes.add(new Triangle(30, 2));
                
                for (Shape s: shapes)
                {
                        System.out.println("Area of this object: " + s.getArea());
                }
        }
}
Viewed 771 times, submitted by Guest.