Hi,

I'm trying to use the method:
Code:

public static int[] copyOfRange(int[] original, int from, int to);

to copy specified values to another array

here is my 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:

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

Have you imported java.util.Arrays?
Which version of java are you compiling with?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.