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


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

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!v102.xanadu-bbs.net!xanadu-bbs.net!us.feeder.erje.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx04.eternal-september.org!.POSTED!not-for-mail
From markspace <markspace@nospam.nospam>
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.
Date Sun, 13 Jan 2013 19:01:05 -0800
Organization A noiseless patient Spider
Lines 22
Message-ID <kcvsdk$eua$1@dont-email.me> (permalink)
References <f2b43fa0-1da2-4dc4-981b-bb756186050b@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
Injection-Date Mon, 14 Jan 2013 03:01:08 +0000 (UTC)
Injection-Info mx04.eternal-september.org; posting-host="61282af8d6595e8d991edb5ac03d6e00"; logging-data="15306"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19cxhICxZHuD1wASMaI15wtS/t7vgoTZwk="
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20130107 Thunderbird/17.0.2
In-Reply-To <f2b43fa0-1da2-4dc4-981b-bb756186050b@googlegroups.com>
Cancel-Lock sha1:5wAC2ritPL+9YHswHHaY7YlefAY=
Xref csiph.com comp.lang.java.help:2445

Show key headers only | View raw


On 1/13/2013 5:38 PM, GCRhoads@volcanomail.com wrote:

> 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.

Two dimensional array?

public class Qht {
   private Piece[][] conf;

   public Qht( int m, int n ) {
     conf = new Piece[m][];
     for( int i = 0; i < m; i++ )  // just wrote "that loop" again
     {
       conf[i] = new Piece[n];
     }
   }
   // rest of class here...
}

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