![]() |
An array is a structure containing the element of a similar data type as one unit. In this article, we will learn the simplest method to print an array in Java. PrerequisitesWhat is the Simplest Method to Print Array in Java?Arrays.toString() method is used to print One-dimensional (1D) Array in Java. This can be invoked by importing “java.util.Arrays” class. To print an array using this method just pass the array into the arguments of the function. Syntax: Arrays.toString(printing_array)
Below is the implementation of printing Array with Arrays.toString() method: Java
Output
Integer Array elements are: [1, 2, 3, 4, 5] Double Array elements are: [1.13, 2.28, 3.33, 44.4, 54.5] String Array elements are: [vivek, deeksha, chaudhary] To know more the topic refer to Java Array article. |
Reffered: https://www.geeksforgeeks.org
Java |
Type: | Geek |
Category: | Coding |
Sub Category: | Tutorial |
Uploaded by: | Admin |
Views: | 13 |