

























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
In Java, arrays are objects so they contain more information, but the data is stored ... Suppose we want to copy the elements of one array to another array.
Typology: Lecture notes
1 / 33
This page cannot be seen from the preview
Don't miss anything!


























int magic = 13; int [] oddNumbers = {1, 3, 5, 7, 9, magic, magic + 2, 17, 19, 21}; System.out.println( oddNumbers[7] ); // prints 17 System.out.println( oddNumbers[4] ); // prints 9 System.out.println( oddNumbers[magic - 4 ] ); // prints 21 System.out.println( oddNumbers[5] - magic ); // prints 0
String myName = new String("Peter Parker"); System.out.println("My name has " + myName.length() + "characters.");
System.out.println("Element at location - 1 is " + numbers[-1]);
double sum; double average; double [] numbers = new double[