6 Replies Latest reply on Feb 3, 2007 9:53 AM by 807599

    ArrayList / Scanner Issues...

    807599
      Hello everyone,

      I'm in an AP Computer Science class in high school and I've run into a problem using ArrayLists. This project is just an experiment, not an actual assignment

      The purpose of this project is to design a BASIC database with as many fields as the user desires. (Example: CD COLLECTION containing the fields "album," "artist," and "album length")

      The problem I am having occurs when I try to assign names to each ArrayList. Here is my coding so far:
      import java.util.ArrayList;
      import java.util.Scanner;
      public class EXPERIMENT
      {
          public static void main(String[] args)
          {
              Scanner input = new Scanner(System.in);
              
              System.out.println("CD COLLECTION EXPERIMENT");      
              
              System.out.print("Enter Number of Fields: ");
              int totalFields = input.nextInt();
              
              for (int i = 1; i <= totalFields; i++)
              {
                  System.out.println("Enter First Field Name: ");
                  char fieldName = input.nextLine();
                  ArrayList<Char> value of fieldName = new ArrayList<Char>();
              }
          }
      }