This commit is contained in:
Emmanuel Srivastava
2025-03-03 21:48:22 +01:00
parent 7a4a32cdc9
commit dc3359eb92
7 changed files with 92 additions and 1 deletions

View File

@@ -0,0 +1,23 @@
import javax.swing.JOptionPane;
public class Test {
public static void main(String[] args) {
Vehicule v;
Object[] choix = {"Voiture", "Moto"};
int reponse = JOptionPane.showOptionDialog(null,
"Quel v\u00E9hicule choisissez-vous ?",
"Question",
JOptionPane.DEFAULT_OPTION,
JOptionPane.QUESTION_MESSAGE,
null,
choix,
null);
if (reponse == 0)
v = new Voiture();
else
v = new Moto();
System.out.println("Une "+v.sorte()+" poss\u00E8de "+v.nbRoues()+" roues.");
}
}