Valeri173

Domashnoto na Krasi 5-2

Feb 4th, 2020
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.62 KB | None | 0 0
  1. public class Program {
  2.  
  3.     public static void main(String[] args) {
  4.         CustomArrayList shoppingList = new CustomArrayList();
  5.        
  6.         shoppingList.add("Milk");
  7.         shoppingList.add("Honey");
  8.         shoppingList.add("Olives");
  9.         shoppingList.add("Bread");
  10.         shoppingList.remove("Olives");
  11.        
  12.         System.out.println("We need to buy:");
  13.  
  14.         for (int i = 0; i < shoppingList.getLength(); i++) {
  15.             System.out.println(shoppingList.elementAt(i));
  16.         }
  17.  
  18.         System.out.println("Do we have to buy Bread? " + shoppingList.contains("Bread"));
  19.  
  20.     }
  21.  
  22. }
Advertisement
Add Comment
Please, Sign In to add comment