hi I java we do not have Multidimentional Array. instead we create Array of Arrrays. I want to create a two dimentional array for storing database tables dynamically. Is there any solution for this problem.
You can contiue adding new lists as necessary. To get a particular element you can:
Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
Joined: Apr 03, 2003
hi Michael This will not solve my purpose. Actually I am creating a table dynamically. JTable table = JTable(Object data,Object column); for this I will have to pass 2D array in the first parameter of the JTable and this array will be generated dynamically.
Depends how dynamic you want this to be. If the numbers of rows and columns are variables, but they don't change after the table is created, then it's easy to use an array of array. E.g. for r rows and c columns, use new Object[r][c] However if the number of rows or columns needs to be able to change after the table is created, you should use a TableModel rather than an Object. See the Java Tutorial on How To Use Tables for more info.