Welcome to the Java Programming Forums

The professional, friendly Java community. 21,500 members and growing!

The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: How to create arrays dynamically??

  1. #1
    Junior Member
    Join Date
    Jul 2011
    Thanked 0 Times in 0 Posts

    Default How to create arrays dynamically??

    i have an arraylist with object arrays in it
    the number of object arrays added to this arraylist may vary
    while iterating through this arraylist i want to dynamically create array for all entries of this arraylist (elements are object arrays)
    for this i need to dynamically give name to arrays so how it is possible to declear an array refrence of to name an array dynamically
    i have tried thorough java.lang.reflect.Array but if any body can give me an example for such a problem will be a great help

  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Eastern Florida
    Thanked 2,659 Times in 2,609 Posts

    Default Re: How to create arrays dynamically??

    how it is possible to declear an array refrence of to name an array dynamically
    Are you asking how to add a new variable name to a compiled program while it is executing?
    You can get that effect by using a Map with the key being the "name" of the value.
    You can create new values and references to those values at execution time.

    If this is not what you want, Can you explain what you are trying to do?

Similar Threads

  1. Having an issue reading files to create two arrays.
    By ccrosby in forum What's Wrong With My Code?
    Replies: 5
    Last Post: July 26th, 2011, 06:47 AM
  2. Question Dynamically create objects, set value and call
    By buntyindia in forum Java Theory & Questions
    Replies: 1
    Last Post: May 25th, 2011, 07:50 AM
  3. Create Multiple Arrays from a text file
    By chris11kgf in forum File I/O & Other I/O Streams
    Replies: 1
    Last Post: February 11th, 2011, 01:40 AM
  4. Updating GUI dynamically
    By KrisTheSavage in forum AWT / Java Swing
    Replies: 2
    Last Post: August 29th, 2010, 08:23 AM
  5. [SOLVED] How to dynamically create ArrayLists (or something similar)?
    By igniteflow in forum Collections and Generics
    Replies: 4
    Last Post: August 6th, 2009, 06:00 AM

Tags for this Thread