Results 1 to 2 of 2
  1. #1
    smokeviolent is offline Member
    Join Date
    Apr 2009
    Posts
    1
    Rep Power
    0

    Default Array problems..

    can someone tell me whats the problem in here or problem may occur in this code?? thanks alotz..

    import java.util.StringTokenizer;
    import java.util.*;
    public class testStknzArrList {

    public static void main(String args[]) {
    ArrayList aL = new ArrayList();
    String str = "Model ;Dell;Class ;Inspiron;Chipset;Core2duo;Ram ;2G;H/d ;250G;Graph/c;Ati newest.ver.";
    String[][] Laptop = new String[1][2];

    StringTokenizer stknz = new StringTokenizer(str,";");
    while(stknz.hasMoreTokens()) {
    Laptop[0][0] = stknz.nextToken();
    Laptop[0][1] = stknz.nextToken();
    aL.add(Laptop);
    Laptop = new String[1][2];
    }
    System.out.println("Element : " + aL.size());
    for(int i=0; i<aL.size();i++) {
    String[][]temp = (String[][]) aL.get(i);
    System.out.println(temp[0][0] + "-||-" + temp[0][1]);
    }
    }
    }
    Last edited by smokeviolent; 04-17-2009 at 06:46 AM.

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

Similar Threads

  1. Array Index problems
    By ragnor2004 in forum New To Java
    Replies: 4
    Last Post: 03-26-2009, 07:53 PM
  2. Array problems
    By Hosticus in forum New To Java
    Replies: 2
    Last Post: 01-18-2009, 02:48 AM
  3. Problems displaying and array of JPanels
    By dousedfirepants in forum New To Java
    Replies: 3
    Last Post: 11-13-2008, 05:47 AM
  4. array problems need your help ASAP!
    By notherand in forum New To Java
    Replies: 1
    Last Post: 06-29-2008, 08:59 PM
  5. problems with array index
    By mary in forum New To Java
    Replies: 2
    Last Post: 08-01-2007, 04:30 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •