Advertisement
anhit92

Zoo

Nov 9th, 2013
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.10 KB | None | 0 0
  1. /*
  2.  * To change this template, choose Tools | Templates
  3.  * and open the template in the editor.
  4.  */
  5. package Ques3;
  6.  
  7. import java.util.ArrayList;
  8. import java.util.Scanner;
  9.  
  10. /**
  11.  *
  12.  * @author Anh-Kool
  13.  */
  14. public class Zoo {
  15.     ArrayList<String> list = new ArrayList<String>();
  16.     String Name;
  17.     Scanner nhap = new Scanner(System.in);
  18.     public void Add(){
  19.         System.out.print("Nhap ten con vat: ");
  20.         Name = nhap.nextLine();
  21.         list.add(Name);
  22.         for (int i = 0; i < list.size(); i++) {
  23.             if(Name.equals(list.isEmpty())){
  24.                 list.add(Name);
  25. //                System.out.println("fjasdjfla");
  26.             }else
  27. //                System.out.println("af");
  28.                 continue;
  29.         }
  30.     }
  31.     public void Remove(){
  32.         String sreachName;
  33.         Scanner s = new Scanner(System.in);
  34.         System.out.print("Nhap ten can xoa: ");
  35.         sreachName = s.nextLine();
  36.                 for (int i = 0; i < list.size(); i++) {
  37.             if(sreachName.equals(list)){
  38.                 list.remove(i);
  39.             }
  40.         }
  41.     }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement