+-----------+ | Faune | +-----------+ ^ | +-----------+ | Mamifere | +-----------+ ^ | +-----------+ | Lion | +-----------+
+------------+ | Vehicule | +------------+ | image | +------------+ | avancer() | | demarrer() | | arreter() | +------------+ ^ ^ / \ / \ / \ / \ +------------+ +------------+ | Voiture | | Avion | +------------+ +------------+ +------------+ +------------+ | reculer() | | monter() | | | | descendre()| +------------+ +------------+
public Vehicule(Image image){ this.image=image; }
public Voiture(){ super(ImageIO.read("imageVoiture.png"); }
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionpublic class Point2D { private int x; private int y; public Point2D(int x, int y){ this.x=x; this.y=y; } public int getX(){ return x; } public int getY(){ return y; } }
public class Point3D extends Point2D { private int z; public Point3D(int x, int y, int z){ super(x, y); this.z=z; } public int getZ(){ return z; } }
public class Mere { public Mere(){ System.out.println("execute"); } } public class Fille extends Mere { public Fille(){ } public static void main(String[] args){ new Fille(); } }
public class Voiture implements IVehicule { public String getType(){ return "Voiture"; } } public class Camion implements IVehicule { public String getType(){ return "Camion"; } }
public class Presentation { public static void presenter(IVehicule vehicule){ System.out.println(vehicule.getType()); } public static void main(String[] args){ Presentation.presenter(new Voiture()); Presentation.presenter(new Camion()); } }