Ive never had the need so far to declare a mutli-demensional array for use with a file but as CaptainPinko pointed out it can be done as
where type can either be a primative type or an object type.Code:type[]identifier = new type[]
Same goes for a mutli-demensional or (two dimensional array)
When declaring mutli-demensional arrays you must either specify row, or rows and cols. ie....... [4][] or [4][4]. Using [][4] would give you an error.Code:type[][]identifier = new type[][]
Arrays are pretty easy to work with but the manner in which they can be declared and initialized can somtimes lead to confusion. For instance....
is the equivalent toCode:int[]x = {0,1,2,3,4};
Anonymous arrays can also be created, Neither the name of the array nor the dimension of the array is specified.Code:int[]x = new int[]{0,1,2,3,4};
If you want to retrieve data from a file then your getting into I/O which consists of streams and such...Code:new int[] {0,1,2,3,4}




Reply With Quote