Computer Science, asked by snehabakshi2002, 3 months ago


1. WAP to initialize an integer array and print the elements.​

Answers

Answered by Anonymous
0

Answer:

JAVA

public class PrintArray {

public static void main(String[] args) {

//Initialize array.

int [] arr = new int [] {1, 2, 3, 4, 5};

System.out.println("Elements of given array: ");

//Loop through the array by incrementing value of i.

for (int i = 0; i < arr.length; i++) {

System.out.print(arr[i] + " ");

Similar questions