public class ArrayNew extends JApplet {
JTextArea Xout = new JTextArea(20, 50);
Random rand = new Random();
public void init() {
Container cp = getContentPane();
cp.setLayout(new FlowLayout());
cp.add(new JLabel("ArrayNew!"));
cp.add(new JScrollPane(Xout));
int[] a;
a = new int[rand.nextInt(20)];
Xout.append(
"length of a = " + a.length + "\n");
for(int i = 0; i < a.length; i++)
Xout.append(
"a[" + i + "] = " + a[i] + "\n");
}
public static void main(String[] args) {
Console.run(new ArrayNew(), 600, 400);
}
} ///:~