Possible Duplicate:
java arraylist to store userinput
Hi using the code in java how would I add an option of asking the user if they want to put another directory in or not and if not to print all the directories out.
import java.util.ArrayList;
import java.util.Scanner;
public class Aaa
{
public static void main(String[] args)
{
ArrayList<String> name = new ArrayList<String>();
ArrayList<Integer> phone = new ArrayList<Integer>();
Scanner sc = new Scanner(System.in);
while (true)
{
System.out.println("Please enter your name: ");
name.add(sc.next());
System.out.println("Please enter your number: ");
phone.add(sc.nextInt());
}
}
}