Difference between revisions of "Printing an Array"

From CompSciWiki
Jump to: navigation, search
Line 11: Line 11:
  
 
|SideSectionTitle=Introducing Arrays
 
|SideSectionTitle=Introducing Arrays
|SideSection=
+
|SideSection=[[Image:Wiki_array01.jpg|float|267px]]
[[Image:Wiki_array01.jpg|float|267px]]
+
 
+
An image or By Students section
+
  
 
|Solution= Put the solution description here
 
|Solution= Put the solution description here

Revision as of 12:42, 6 April 2010

Back to the Program-A-Day homepage

Problem

This problem involves you printing out an array of integers using a for loop. You want to make an array of 10 integers with values you can hard code into the program. Use System.out.println() to print out the integers. Remember that you can create an array of any type with hard coded values like this:

int[] array = {1, 2, 3};

Also remember that arrays start their indexing at 0 and you can check the length of an array in Java this way:

int length = array.length;
 

Introducing Arrays

float

Solution

Put the solution description here

Code

Solution Code

Back to the Program-A-Day homepage