Welcome to the World of Online Learning:
Hello Friends “This blog helps you to learn Java programming concepts. You can learn Java language at your own speed and time. One can learn concepts of Java language by practicing various programs given on various pages of this blog. Enjoy the power of Self-learning using the Internet.”

Write a Java Program to Print an Array
PROGRAM:Java Program to Print an Array
/*Java Program to Print an Array*/
1: Print an Array using For loop
public class Array {
public static void main(String[] args) {
int[] array = {1, 2, 3, 4, 5};
for (int element: array) {
System.out.println(element);
}
}
}
2: Print an Array using standard library Arrays
import java.util.Arrays;
public class Array {
public static void main(String[] args) {
int[] array = {1, 2, 3, 4, 5};
System.out.println(Arrays.toString(array));
}
}
3: Print a Multi-dimensional Array
import java.util.Arrays;
public class Array {
public static void main(String[] args) {
int[][] array = {{1, 2}, {3, 4}, {5, 6, 7}};
System.out.println(Arrays.deepToString(array));
}
}