Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Main2 {
- /**
- * @param args
- */
- public static void main(String[] args) {
- Rectangle r = new Rectangle(40,10);
- GetArea(r);
- Square s = new Square(50);
- GetArea(s);
- Drawable d = new Rectangle(10,10);
- Draw(r);
- Draw(s);
- Draw(d);
- }
- public static void Draw(Drawable shape) {
- shape.Draw();
- }
- public static void GetArea(Rectangle r) {
- r.getArea();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment