why am i getting this error? > testParser.java:11: Array dimension missing. > static public String[] CName=new String[]; if i change it to: static public String[] CName=new String[8]; it accepts it. but i don't want to do that. i don't know how long the string array is going to be. it depends on data. thanks in advance jb
Val Dra
Ranch Hand
Joined: Jan 26, 2001
Posts: 439
posted
0
> testParser.java:11: Array dimension missing. > static public String[] CName=new String[]; when you try to define it like this you don't give a dimension size which is not allowed. You must provide size or do it like this String []s = new String[]{"yes"};
Val SCJP <BR>going for SCJD
Manfred Leonhardt
Ranch Hand
Joined: Jan 09, 2001
Posts: 1492
posted
0
Hi Jay, In Java array size is set at compile time and can't be changed at any other time. If you want to use something that is sizeable try using a vector. Once you get the total vector you can use the toArray() method to get the contents into an array. Manfred.
Jay X Brown
Ranch Hand
Joined: Jan 26, 2001
Posts: 51
posted
0
thanks val, it compiled without problem. but what does this do? > String []s = new String[]{"yes"};
and thanks for the vector suggestion. i now realize that is another route to go. jay
ryan burgdorfer
Ranch Hand
Joined: Jan 24, 2001
Posts: 219
posted
0
it specifies what is in the array...in this case, one string - "yes" I think you may find that this is not going to be the ultimate solution in your case, since you said above that the size of the array depends on your data. In this case, your array has a size of 1...