1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
|
Scanner sc = new Scanner(System.in);
System.out.println("Veuillez choisir : ");
int choix = sc.nextInt();
if(choix != 1 && choix != 2 && choix != 3) {
do {
System.err.println("veuillez entrer un entier compris entre 1 et 3");
choix =sc.nextInt();
}while(choix != 1 && choix != 2 && choix != 3);
}
if(choix==1) {
bp.testWithFile("/Users/macbook/Documents/eclipse/complexite/src/main/file.txt");
}else if(choix==2) {
System.out.println("Saisir une chaine ");
String str = sc.nextLine();
bp.testWithScanner(str);
}else {
System.out.println("To Do");
} |