Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.help > #2444

Re: Array of a Class Type that contains an array where the sizes of the array are not known at compile time.

Path csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder2.hal-mli.net!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post01.iad.highwinds-media.com!newsfe12.iad.POSTED!not-for-mail
From Daniel Pitts <newsgroup.nospam@virtualinfinity.net>
User-Agent Mozilla/5.0 (Macintosh; Intel Mac OS X 10.6; rv:17.0) Gecko/17.0 Thunderbird/17.0
MIME-Version 1.0
Newsgroups comp.lang.java.help
Subject Re: Array of a Class Type that contains an array where the sizes of the array are not known at compile time.
References <f2b43fa0-1da2-4dc4-981b-bb756186050b@googlegroups.com>
In-Reply-To <f2b43fa0-1da2-4dc4-981b-bb756186050b@googlegroups.com>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
Lines 38
Message-ID <atKIs.36232$TH3.9358@newsfe12.iad> (permalink)
X-Complaints-To abuse@newsrazor.net
NNTP-Posting-Date Mon, 14 Jan 2013 02:56:06 UTC
Date Sun, 13 Jan 2013 18:56:07 -0800
X-Received-Bytes 1929
Xref csiph.com comp.lang.java.help:2444

Show key headers only | View raw


On 1/13/13 5:38 PM, GCRhoads@volcanomail.com wrote:
>
> class Piece
>     {
>     public byte type;
>     public byte loc;
>     }
>
> class Config
>     {
>     public Config( int n ) { piece = new Piece[ n ]; }
>     private Piece[] piece;      // array whose size is not known at compile time
>     private int next;
>     private int parent;
>     }
>
> class QHT
>     {
>     private Config[] conf;
>     public QHT (int m, int n );
>     }
>
> In the constructor QHT, I want to allocate to "conf" an array of m Configs
> where each Config contains an array of n "Piece"s.  The values of m and n
> are not known at compile time only at run time.
>
> How can I do this in Java?
>
> P.S. If you respond by email, please use the following address.
> r h o a d s @ c s (dot) r u t g e r s (dot) e d u
>
>
>
Java arrays don't get instantiated at compile time, so you just do it 
the way you create arrays in Java.

Hint: You have an example of part of it in he Config constructor already.
Another Hint: Do your own damned homework.

Back to comp.lang.java.help | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Array of a Class Type that contains an array where the sizes of the array are not known at compile time. GCRhoads@volcanomail.com - 2013-01-13 17:38 -0800
  Re: Array of a Class Type that contains an array where the sizes of the array are not known at compile time. Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2013-01-13 18:56 -0800
    Re: Array of a Class Type that contains an array where the sizes of the array are not known at compile time. GCRhoads@volcanomail.com - 2013-01-14 13:36 -0800
      Re: Array of a Class Type that contains an array where the sizes of the array are not known at compile time. Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-01-14 16:59 -0500
        Re: Array of a Class Type that contains an array where the sizes of the array are not known at compile time. GCRhoads@volcanomail.com - 2013-01-14 20:00 -0800
          Re: Array of a Class Type that contains an array where the sizes of the array are not known at compile time. GCRhoads@volcanomail.com - 2013-01-14 20:04 -0800
            Re: Array of a Class Type that contains an array where the sizes of the array are not known at compile time. Patricia Shanahan <pats@acm.org> - 2013-01-14 23:44 -0800
            Re: Array of a Class Type that contains an array where the sizes of the array are not known at compile time. Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-01-15 09:07 -0500
          Re: Array of a Class Type that contains an array where the sizes of the array are not known at compile time. Jukka Lahtinen <jtfjdehf@hotmail.com.invalid> - 2013-01-15 09:06 +0200
          Re: Array of a Class Type that contains an array where the sizes of the array are not known at compile time. Eric Sosman <esosman@comcast-dot-net.invalid> - 2013-01-15 08:32 -0500
          Re: Array of a Class Type that contains an array where the sizes of the array are not known at compile time. Lew <lewbloch@gmail.com> - 2013-01-15 11:19 -0800
          Re: Array of a Class Type that contains an array where the sizes of the array are not known at compile time. Joshua Cranmer <Pidgeot18@verizon.invalid> - 2013-01-15 13:52 -0600
      Re: Array of a Class Type that contains an array where the sizes of the array are not known at compile time. Roedy Green <see_website@mindprod.com.invalid> - 2013-01-15 20:56 -0800
  Re: Array of a Class Type that contains an array where the sizes of the array are not known at compile time. markspace <markspace@nospam.nospam> - 2013-01-13 19:01 -0800
    Re: Array of a Class Type that contains an array where the sizes of the array are not known at compile time. Lew <lewbloch@gmail.com> - 2013-01-13 21:39 -0800

csiph-web