Print Array in java :
- Code:
import java.util.Scanner;
import java.util.Arrays;
public class PrintArray {
public static void main(String[] args){
Scanner scan = new Scanner(System.in);
int [] Arr = new int[5];//[5] is showing a length of array
String str;
System.out.println("Enter the Array Element:");
for(int i=0;i<Arr.length;i++){
Arr[i] = scan.nextInt();
}
str = Arrays.toString(Arr);
System.out.println("Array Of Numbers:"+str);
}
}
- Input
2
3
4
5
- Output
Click on Image For Program View
🙏THANKS FOR VISIT🙏
Print Array in Java - CodexRitik
Reviewed by CodexRitik
on
July 29, 2020
Rating:
No comments: