Task3 Array copying into another Array

public class Copy1Array2another {

* @param args
public static void main(String[] args) {

int[] oldArray={1,3,4}, newArray;
// Let’s pretend we filled up oldArray and initialized newArray here
// Now, copy them over
newArray=new int[2];
System.arraycopy(oldArray, 0, newArray, 0, 2);
System.out.println(“displaying old array”);
for(int i=0;i<3;i++)
System.out.println(“displaying new array”);
for(int i=0;i<2;i++)



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s