exo2 TP Generecite
This commit is contained in:
Binary file not shown.
20
DEV.3.2/TP/TP1-Generecite/Tableaux.java
Normal file
20
DEV.3.2/TP/TP1-Generecite/Tableaux.java
Normal file
@@ -0,0 +1,20 @@
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
|
||||
public class Tableaux {
|
||||
public static void main(String[] args) {
|
||||
System.out.println("Tous les arguments : " + Arrays.toString(args)); // On affiche tous les arguments
|
||||
|
||||
|
||||
String[] premiers = Arrays.copyOf(args, 5);
|
||||
System.out.println("Les 5 premiers : " + Arrays.toString(premiers)); // On affiche les 5 premiers arguments
|
||||
|
||||
Arrays.sort(args);
|
||||
System.out.println("Tri alphabétique : " + Arrays.toString(args)); // On affiche les arguments triés alphabétiquement
|
||||
|
||||
Arrays.sort(args, Comparator.reverseOrder());
|
||||
System.out.println("Tri inverse : " + Arrays.toString(args)); // On affiche les arguments triés en ordre inverse
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user