Exercice 01
Exercice 01
Exercice 01
package hello;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
listeChaines.add("Bonjour");
listeChaines.add("à");
listeChaines.add("tous");
System.out.println(listeChaines.get(i));
System.out.println(chaine);
}
// Afficher les éléments en utilisant un itérateur
while (iterator.hasNext()) {
System.out.println(iterator.next());
}Exercice02
package hello;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
listeChaines.add("Orange");
listeChaines.add("Banane");
listeChaines.add("Pomme");
listeChaines.add("Fraise");
afficherListe(listeChaines);
Collections.sort(listeChaines);
afficherListe(listeChaines);
System.out.println(chaine);
Exrcice03
package hello;
import java.util.HashMap;
import java.util.Map;
colorMap.put(1, "Red");
colorMap.put(2, "Green");
colorMap.put(3, "Black");
colorMap.put(4, "White");
colorMap.put(5, "Blue");
System.out.println("Sample Output:");
Exercice04
package hello;
import java.util.HashMap;
import java.util.Map;
colorMap.put(1, "Red");
colorMap.put(2, "Green");
colorMap.put(3, "Black");
colorMap.put(4, "White");
colorMap.put(5, "Blue");
testIfValueExists(colorMap, "Green");
testIfValueExists(colorMap, "orange");
if (map.containsValue(value)) {
} else {
System.out.println();
}
}
Hyritage05
class Person
System.out.println("Hello");
age = n;
}
}
System.out.println("Explanation begins");
//Classe de test
p.sayHello();
s.goToClasses();
s.setAge(15);
s.sayHello();
s.displayAge();
t.setAge(40);
t.sayHello();
t.explain();
}