Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Array of a Class Type containing an Array: array sizes are dynamic

$
0
0
I have the following class type declared.

class Piece
   {
   public byte type;
   public byte loc;
   }

class Config
   {
   private Piece [] piece;
   private int next;
   private int parent;
   public Config( int n ) {piece = new Piece[ n ];}
   }

class QHT
   {
   private Config [] conf;
   public QHT( int m, int n );
   }



In the QHT constructor, I want to allocate to "conf" an array of m Configs where each Config contains an array of n
Pieces. The value of n is not known at compile time. How can I do this in Java?

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>