Advertisement
Guest User

Untitled

a guest
Jun 19th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.63 KB | None | 0 0
  1.     public static void main(String[] args) {
  2.         String[] customerProducts = new String[5];
  3.         Scanner scn = new Scanner(System.in);
  4.         for (int i = 0; i<5; i++){
  5.             customerProducts[i] = scn.nextLine();
  6.         }
  7.         foundProduct(customerProducts);
  8.     }
  9.    
  10.     private static void foundProduct(String[] customerProducts){
  11.         List products = Arrays.asList(new String[]{"black","white"});
  12.         for (int i = 0; i < customerProducts.length; i++) {
  13.             if (products.contains(customerProducts[i])) {
  14.                 System.out.println("found " + customerProducts[i]);
  15.             }
  16.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement