Results 1 to 2 of 2
  1. #1
    matrixcool is offline Member
    Join Date
    Dec 2010
    Posts
    21
    Rep Power
    0

    Default Using the method copyOfRangle ??

    Hi,

    I'm trying to use the method:
    Java Code:
    public static int[] copyOfRange(int[] original, int from, int to);
    to copy specified values to another array

    here is my code:
    Java Code:
    // I have an array a of integers but the error in this line
    int [] b = Arrays.copyOfRange(a,0,n);

    but it gave me a compile error and I don't know why !!
    the error is:

    Java Code:
    cannot find symbol
    symbol  : method copyOfRange(int[],int,int)
    location: class java.util.Arrays
                int [] b = Arrays.copyOfRange(a,0,n);

    any help will be highly appreciated :o

  2. #2
    gcalvin is offline Senior Member
    Join Date
    Mar 2010
    Posts
    952
    Rep Power
    5

    Default

    Can't see where you've declared a and n, but the problem has to do with one or both of them. Please note that int[] b is much better style than int [] b.

    -Gary-

Similar Threads

  1. Thread problem, calling method in run method
    By majk in forum Threads and Synchronization
    Replies: 4
    Last Post: 09-27-2010, 12:40 PM
  2. Turning Recursion Method into Iterative method
    By mattakuevan in forum New To Java
    Replies: 9
    Last Post: 06-15-2010, 07:46 AM
  3. Replies: 2
    Last Post: 03-26-2010, 06:12 PM
  4. Replies: 29
    Last Post: 09-25-2008, 08:55 PM
  5. cannot call private method from static method
    By jon80 in forum New To Java
    Replies: 3
    Last Post: 05-07-2008, 09:37 AM

Posting Permissions

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