Arrays.toString(char[]): This method is available in java.util.Arrays class of Java.
Syntax:
String java.util.Arrays.toString(char[] a)
This method takes one argument of type char array as its parameter. This method returns a string representation of the contents of the specified array.
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 ArraystoStringchar {public static void main(String[] args) {char a[] = { 'a', 'v', 'm', 'o' };System.out.println(Arrays.toString(a));}}
Output:
[a, v, m, o]
No comments:
Post a Comment