• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

arrays

 
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
when i create a array like follos

int [][][] b=new int[1][][];

how can i assign to this array
please give all the posible ways
 
author
Posts: 23958
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by asanka vithanage:
when i create a array like follos

int [][][] b=new int[1][][];

how can i assign to this array
please give all the posible ways




Well, b is an array to arrays to arrays of int. so, you can assign arrays of arrays of ints to the elements of the b array, since the elements of that array are arrays of arrays of ints.

b[0] = new int[10][12];

And you can assign arrays of ints to the elements of the elements of the b array, since those elements are arrays of ints.

b[0][5] = new int[42];

And you can assign ints to those elements, since those elements are arrays of ints.

b[0][5][23] = 56;

Henry
 
Think of how dumb the average person is. Mathematically, half of them are EVEN DUMBER. Smart tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic