Skip to editor
File
New File Ctrl+N
New Folder

Save Ctrl+S
Upload File…
Download as ZIP

Delete File

Reset Files…
View
Toggle Sidebar Ctrl+B
Toggle Terminal Ctrl+`

Word Wrap Alt+Z

Exercise Info
Run
Run Code Ctrl+Enter
Save & Run F5

Clear Output
CS174: OOP - Drills - Printing array with commas
Explorer
GitHub

Connect to GitHub to push and pull your project files to a repository.

On the page that opens, create a token with repo scope, copy it, then paste it below.

Paste the personal access token you created on GitHub with repo scope.

Click Refresh to load commit history
Exercise Info
← Prev Next →

Goals

  1. To declare a public static method to some specification
  2. To do proper array indexing
  3. To use loops in concert with arrays
  4. To use logic inside of a loop
  5. To use the System.out.print method properly

Instructions

Declare a void method printArray in the ArrayPrinter class. This method should take an array of ints, and it should then print out the elements of the array separated by commas (this is useful, since printing out an array by default in Java just gives its memory address). For example, the array {0,5,2,4} should be printed out as 0, 5, 2, 4. Note how there is no comma or space at the end of the output string.

The Ursinus-WebIDE by Chris Tralie (opens in new tab) and Bill Mongan (opens in new tab)

Your browser does not support WebGL. A graphical rendering canvas would appear here.


          
No suggestions. Code quality feedback will appear here.
Not logged in java
Ln 1, Col 1