Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package formalab.seance4.exercice1;
- import java.util.ArrayList;
- import java.util.Scanner;
- public class Exercice2 {
- public static void main(String[] args) {
- int i ;
- ArrayList<String> names =new ArrayList <String>();
- Scanner reader = new Scanner(System.in);
- for(i=0;i<4;i++) {
- System.out.println("entrer un nom : ");
- String nom=reader.next();
- names.add(nom);
- }
- System.out.println("choisir un nom pour le chercher haha: ");
- String nomchercher = reader.next();
- System.out.println("exist : "+names.contains(nomchercher));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement