How Can We Print an Array in Java ?

We can print an array by using methods of Arrays class. We can either use Arrays.toString() method or we can use Arrays.deepToString() method.

Since array doesn't implement toString() method by itself, just passing an array to System.out.println() will not print its contents. But we can use Arrays.toString() to print each element of an array.



You May Interest

What is Difference Between Include Directive and Include Action o ...

What are the Differences Between a HashSet and a HashMap in Java ...

How Will You Use a Cookie in JSP ?

What is a Singleton Class in Java ?

How Can You Make an Object Eligible for Garbage Collection in Jav ...