SHARE
TWEET

2

Xrocky Dec 8th, 2019 79 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package formalab.seance4.exercice1;
  2.  
  3. import java.util.ArrayList;
  4. import java.util.Scanner;
  5.  
  6. public class Exercice2 {
  7.  
  8.  
  9.     public static void main(String[] args) {
  10.         int i ;
  11.         ArrayList<String> names  =new  ArrayList <String>();
  12.         Scanner reader = new Scanner(System.in);
  13.         for(i=0;i<4;i++) {
  14.             System.out.println("entrer un nom : ");
  15.            
  16.             String nom=reader.next();
  17.             names.add(nom);
  18.         }
  19.     System.out.println("choisir un nom pour le chercher haha: ");
  20.     String nomchercher = reader.next();
  21.    
  22.     System.out.println("exist : "+names.contains(nomchercher));
  23.     }
  24.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top