0% found this document useful (0 votes)
2 views4 pages

Array List

The document outlines a Java program for managing a list of students using an ArrayList. It includes functionalities for adding, searching, deleting, modifying student names, displaying the total number of students, and clearing the list. The program interacts with the user through a console interface for input and output operations.

Uploaded by

ivelianeyala
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
2 views4 pages

Array List

The document outlines a Java program for managing a list of students using an ArrayList. It includes functionalities for adding, searching, deleting, modifying student names, displaying the total number of students, and clearing the list. The program interacts with the user through a console interface for input and output operations.

Uploaded by

ivelianeyala
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 4
LP import jav util ArrayList; 2 import java.util Seonner 3 7 8 & public class GestionEtudiant { public static votd wain(String[] aces) Vi Oselaration et Instanciation. Scanner se = new Scanner(Systen.én); ArcayListeString> Listettudiant = new Arrayliste>()s Hiasous, Exudionts Listettudiant.odd(*19y"95 Listettudiantsda("Ana"); Listettudiantoda*Belvina"); Listettudiantedd(*Princesse"); Lisseichane de Ye Liste Systen.out.println("Liste des dtudiants:"slistettudiant); Hinecherche. d'un geudiont system.out.print(“Entrez le non 8 rechercher = ")5 String om = sc.nexthine(); Af (Listeztudiant .contains(non)) ( Systen.oue.printIn(con +” est présent dans la liste."); pease ( Systen.out.printin("Etudiant non teouvé."); ? J/suppression d'un & system.out.print("Entrez le nom & supprimes = ")5 String suppriner = sc.nextLine()3 if (listeEtudiant.renove(supprimer)) { ‘system.out.println("Etudiant supprimé."); }aase ( System.out.printIn(“Hom introuvable.”). ? System.out.printIn("Liste mise @ jour : + Listettudiant);, //Modifiaction d'un Studiant system.out.print("Nom actuel 3 modifier : "); String anciention = sc.nextLine()5 4F (Listettudiant.contains(ancienlion)) { system.out.print ("Nouveau nom: ")3 String nouveautlon = sc.nextLine(); int index = listettudiant.indexof(ancientlom) Listettudiant.set(index, nouveauliom) 5 System.out.printIn("Nom modifié avec succes } else System.out.printIn("Hom introuvable.") } System.out.printla("Liste Finale v5 + Listettudiant); system. out.print( vs 2 Ant index = se.nextIntO; 3 Af (index >= @ Bk index ¢ ListeEtudiant.size()) ( ‘systen-out.printla( index + + Listettudiont.getCindex)); 5 yeise { 3 Systen-out.printin( v5 ? ) Afficher le nowbre total d*étudi systen.out.println( + Listeetudiant.si2e())s Liste‘ tudiant-clearQ; systen-out.println( 5 system out.printin( + Lictertudiant.cize())3 close ()s Set ats Cae ee Cel iad java OTe Recta seta CnC eeC 14 @ 2. Afficher tous les étudiants de la liste rrr) Te Carta eT System. out.print1n(nom) ; 3. Rechercher un étudiant par son nom I Bean Git eee cr Ga cue Str suyg { System.out.printIn("Etudiant non tr @ 4. Supprimer un étudiant par son nom ra) Pere ee Ces @ 5. Modifier un étudiant (remplacer un nom) ed Bee tre een comets eam | Gare cecaden oe Re ea Re Lee (oa esa Pee @ 7. Afficher le nombre total d’étudiants crc etudiant: On Pus ae oc @ 8. Vider totalement la liste 0) etudiants.clear();

You might also like