{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

UseArrays - int vals = new int[10 for(i=0 i<vals.length...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
class UseArrays { c // this program will take command line arguments that look // like numbers and print the square of each one public static void main (String[] args) { int i; i = 12; /* double vals[]; // array declaration // just information for the compiler // about types vals = new double[10]; // array creation in memory
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: */ int vals = new int[10]; for (i=0; i<vals.length; i++) { // put i*i into the array at slot i vals[i] = i*i; } // print out the values stored in the array System.out.println("From the array: "); for (i=0; i<vals.length; i=i+1) { System.out.println(vals[i]); } } }...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online