Array: Display the contents of an array

Q) Display the contents of an array

public class ArrayDisplaySample {
  
  public void showArray (int [] sampleArray){
    for(int i=0; i<sampleArray.length; i++){ //running a loop through the length of the array
      System.out.println(sampleArray[i]); //printing each element
    }  
  }  
}

Leave a Reply

PHP JS HTML CSS BASH PYTHON CODE

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this:
search previous next tag category expand menu location phone mail time cart zoom edit close