Difference between revisions of "Print Array"
From CompSciWiki
Line 26: | Line 26: | ||
} | } | ||
} | } | ||
− | <pre> | + | </pre> |
}} | }} |
Revision as of 12:32, 30 March 2010
Back to the Program-A-Day homepage
ProblemWrite a method which will take an array of ints as a parameter.
The method should print the elements of the array, separated by a comma.
|
SideSectionTitle
An image or By Students section | |
---|---|---|
SolutionThe solution... public static void printArray( int[] n ) { for( int i = 0; i < n.length; i++ ) { System.out.print( n[i] + "," ); } } | ||
CodeSolutionCode goes here. Please DO NOT put your code in <pre> tags! |