The Artima Developer Community
Sponsored Link

Java Answers Forum
<thing in java 2nd>-Filling an array

2 replies on 1 page. Most recent reply: Apr 8, 2005 6:54 PM by Martin

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 2 replies on 1 page
Martin

Posts: 3
Nickname: martinren
Registered: Apr, 2005

<thing in java 2nd>-Filling an array Posted: Apr 7, 2005 8:59 PM
Reply to this message Reply
Advertisement
I have Initialized Array a1 ..a9,why can't i use them ?
please tell me the reason ,Thanks a lot!!!

import com.bruceeckel.util.*;
import java.util.*;

public class FillingArrays {
public static void main(String[] args) {
int size = 6;
// Or get the size from the command line:
if(args.length != 0)
size = Integer.parseInt(args[0]);
boolean[] a1 = new boolean[size];
byte[] a2 = new byte[size];
char[] a3 = new char[size];
short[] a4 = new short[size];
int[] a5 = new int[size];
long[] a6 = new long[size];
float[] a7 = new float[size];
double[] a8 = new double[size];
String[] a9 = new String[size];
Arrays.fill(a1, true);
Arrays2.print("a1 = ", a1);
Arrays.fill(a2, (byte)11);
Arrays2.print("a2 = ", a2);
Arrays.fill(a3, 'x');
Arrays2.print("a3 = ", a3);
Arrays.fill(a4, (short)17);
Arrays2.print("a4 = ", a4);
Arrays.fill(a5, 19);
Arrays2.print("a5 = ", a5);
Arrays.fill(a6, 23);
Arrays2.print("a6 = ", a6);
Arrays.fill(a7, 29);
Arrays2.print("a7 = ", a7);
Arrays.fill(a8, 47);
Arrays2.print("a8 = ", a8);
Arrays.fill(a9, "Hello");
Arrays2.print("a9 = ", a9);
// Manipulating ranges:
Arrays.fill(a9, 3, 5, "World");
Arrays2.print("a9 = ", a9);
}
} ///:~

the Problems are:
FillingArrays.java [25:1] cannot resolve symbol
symbol : method fill (boolean[],boolean)
location: class Arrays
Arrays.fill(a1, true);
^
/*....*/

FillingArrays.java [44:1] cannot resolve symbol
symbol : method fill (java.lang.String[],int,int,java.lang.String)
location: class Arrays
Arrays.fill(a9, 3, 5, "World");
^
10 errors
Errors compiling main.

I have Initialized Array a1 ..a9,why can't i use them ?
please tell me the reason ,Thanks a lot!!!


Matthias Neumair

Posts: 660
Nickname: neumi
Registered: Sep, 2003

Re: <thing in java 2nd>-Filling an array Posted: Apr 7, 2005 10:40 PM
Reply to this message Reply
I could compile it with no errors using Java 1.4.05 and 1.5.02
Of course I had to remove first the references to Arrays2 and mport com.bruceeckel.util

What Java version are you using?

Martin

Posts: 3
Nickname: martinren
Registered: Apr, 2005

Thanks Matthias Neumair !!! Posted: Apr 8, 2005 6:54 PM
Reply to this message Reply
I made a mistake.There was another Arrays.java in same packet.
anyway ,thanks for reply!

Flat View: This topic has 2 replies on 1 page
Topic: draw behind component. Previous Topic   Next Topic Topic: Code not giving desired output

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use