Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * To change this template, choose Tools | Templates
- * and open the template in the editor.
- */
- package Ques3;
- import java.util.ArrayList;
- import java.util.Scanner;
- /**
- *
- * @author Anh-Kool
- */
- public class Zoo {
- ArrayList<String> list = new ArrayList<String>();
- String Name;
- Scanner nhap = new Scanner(System.in);
- public void Add(){
- System.out.print("Nhap ten con vat: ");
- Name = nhap.nextLine();
- list.add(Name);
- for (int i = 0; i < list.size(); i++) {
- if(Name.equals(list.isEmpty())){
- list.add(Name);
- // System.out.println("fjasdjfla");
- }else
- // System.out.println("af");
- continue;
- }
- }
- public void Remove(){
- String sreachName;
- Scanner s = new Scanner(System.in);
- System.out.print("Nhap ten can xoa: ");
- sreachName = s.nextLine();
- for (int i = 0; i < list.size(); i++) {
- if(sreachName.equals(list)){
- list.remove(i);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement