ArraysAsParameters

ArraysAsParameters - /Arrays as parameters to methods i...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
//Arrays as parameters to methods / import java.util.*; i public class ArraysAsParameters { static final int ARRAY_SIZE = 10; static Scanner console = new Scanner(System.in); public static void main(String[] args) { int[] listA = new int[ARRAY_SIZE]; //Line 1 int[] listB = new int[ARRAY_SIZE]; //Line 2 System.out.print("Line 3: listA elements: "); //Line 3 //output the elements of listA using //the method printArray printArray(listA, listA.length); //Line 4 System.out.println(); //Line 5 System.out.print("Line 6: Enter " + listA.length + " integers: "); //Line 6 //input data into listA using the method fillArray fillArray(listA, listA.length); //Line 7 System.out.println(); //Line 8 System.out.print("Line 9: After filling " + "listA, the elements are:" + "\n "); //Line 9 //output the elements of listA printArray(listA, listA.length); //Line 10 System.out.println(); //Line 11 //find and output the sum of the elements of listA System.out.println("Line 12: The sum of the " + "elements of listA is: "
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 06/17/2011 for the course COMP 2301 taught by Professor Staff during the Spring '10 term at Kennesaw.

Page1 / 3

ArraysAsParameters - /Arrays as parameters to methods i...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online