Skip to content
Snippets Groups Projects
Commit 78568cb9 authored by Peter Hertkorn's avatar Peter Hertkorn
Browse files

Alien classes

parent c6a0a5bf
No related merge requests found
package aliensimulator;
public abstract class Alien {
public abstract void darstellen();
public void fliegen() {
System.out.println("Ich fliege durch den Weltraum.");
}
}
package aliensimulator;
public class AlienMars extends Alien {
public void darstellen() {
System.out.println("Ich bin das Alien vom Mars.");
}
}
package aliensimulator;
public class AlienMond extends Alien {
public void darstellen() {
System.out.println("Ich bin das Alien vom Mond.");
}
}
package aliensimulator;
public class AlienSimulator {
public static void main(String[] args) {
Alien alien = new AlienMars();
alien.darstellen();
alien.fliegen();
alien = new AlienMond();
alien.darstellen();
alien.fliegen();
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment