What's wrong?
package de.codegym.task.task14.task1412;
/*
Die Methode printMainInfo implementieren
*/
public class Solution {
public static void main(String[] args) {
Object obj = new Circle();
Movable movable = (Movable) obj;
Drawable drawable = new Rectangle();
printMainInfo(drawable);
printMainInfo(movable);
}
public static void printMainInfo(Object object) {
//schreib hier deinen Code
if(object instanceof Movable){
Solution.move();
}
else if(object instanceof Drawable){
Solution.draw();
}
}
static interface Movable {
void move();
}
static class Circle implements Movable {
public void draw() {
System.out.println("Kann gezogen werden");
}
public void move() {
System.out.println("Kann bewegt werden");
}
}
static interface Drawable {
void draw();
}
static class Rectangle implements Drawable {
public void draw() {
System.out.println("Kann gezogen werden");
}
public void move() {
System.out.println("Kann bewegt werden");
}
}
}