Thomas SMETS
Posts: 307
Nickname: tsmets
Registered: Apr, 2002
|
|
Re: how to do configuration to load java standard library?
|
Posted: Apr 26, 2002 5:42 AM
|
|
Without knowing what you do, I believe you have classpath problem. This is completely valid :
import java.util.*;
....
boolean[] a1 = new boolean[size];
Arrays.fill(a1, true);
...
This works well :
package test.lang;
import java.util.Arrays;
public class ArrayFill
{
public static final int ARRAY_SIZE = 10;
public static final String TRUE = " true";
public static final String FALSE = " false";
public static void main (String[] args)
{
boolean[] b = new boolean[ARRAY_SIZE];
show (b);
Arrays.fill (b, true);
show (b);
}
public static void show(boolean[] aBooleanArray)
{
StringBuffer buf = new StringBuffer ();
buf.append ('[');
for (int i = 0; i < (aBooleanArray.length-1); i++)
buf.append ((aBooleanArray[i]?TRUE:FALSE)).append(',');
buf.append (' ')
.append (aBooleanArray[aBooleanArray.length-1])
.append (']');
System.out.println ("b[] = " + buf.toString ());
}
}
Output is
b[] = [ false, false, false, false, false, false, false, false, false, false] b[] = [ true, true, true, true, true, true, true, true, true, true]
Thomas SMETS, SCJP - Brussels
|
|