Arrays.deepToString(Object[]): This method is avaialable in java.util.Arrays class of Java.
Syntax:
String java.util.Arrays.deepToString(Object[] a)
This method takes one argument of type Object array as its parameter. This method returns a string representation of the "deep contents" of the specified array. If the array contains other arrays as elements, the string representation contains their contents, and so on.
Note: This method is designed for converting multidimensional arrays to strings.
Parameters: One parameter is required for this method.
a: the array whose string representation to return.
Returns: a string representation of a.
Exceptions: NA
Approach
Java
import java.util.Arrays;public class ArraysdeepToString {public static void main(String[] args) {Object a[] = { 'a', 'b', 'c', 'd' };System.out.println(Arrays.deepToString(a));}}
Output:
[a, b, c, d]
No comments:
Post a Comment