Results 1 to 2 of 2
  1. #1
    theodorekon is offline Member
    Join Date
    Apr 2010
    Posts
    5
    Rep Power
    0

    Default Creating an arbitrary number of variables

    Hi,
    I have the following problem. I've written a program which reads a txt file which contains an arbitrary number of lines with names. What I want is to store these names in variables. To make this more clear lets say that I have a file like that:

    George
    Nick
    Helen

    I want my program to read through this file and create as many variables as the names in it. That is:

    x="George";
    y="Nick";
    z="Helen";

    But if I don't know the number of the variables from the beginning (because as I said the namelist length is arbitrary) how can I create that many variables??

  2. #2
    PhHein's Avatar
    PhHein is offline Senior Member
    Join Date
    Apr 2009
    Location
    Germany
    Posts
    1,430
    Rep Power
    7

Similar Threads

  1. Printing the Number of Times a Number in a Range Shows up
    By space4rent00 in forum New To Java
    Replies: 1
    Last Post: 02-05-2010, 11:42 PM
  2. What are Instance variables and static variables?
    By sandeshforu in forum New To Java
    Replies: 3
    Last Post: 09-09-2009, 06:48 PM
  3. Creating a Number Input Dialog in SWT
    By Java Tip in forum SWT Tips
    Replies: 0
    Last Post: 07-02-2008, 08:53 PM
  4. Replies: 2
    Last Post: 12-12-2007, 06:01 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •