Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- package com.mycompany.ex20;
- public class Main {
- public static void main(String[] args) {
- // определяем переменную типа Shape
- Shape s;
- // s1 - типа Shape
- Shape s1 = new Rectangle();
- s1.draw();// какой метод draw будет вызваться ???
- //
- Shape s2 = new Square();
- s2.draw(); // какой метод draw будет вызваться ???
- Rectangle r1 = new Square();
- r1.draw(); // какой метод draw будет вызваться ???
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement