Convert two dimensional array to string in Java
Description
The following code shows how to convert two dimensional array to string.
Example
//from w ww . j a v a 2 s . c o m
import java.util.Arrays;
public class Main {
public static void main(String args[]) {
String s[] = {"a", "b", "c", "d"};
double d [][]= {
{0.50, 0.20, 0.20, 0.30},
{0.50, 1.10, 0.50, 0.80},
{0.50, 0.70, 0.40},
{0.50, 0.70},
{0.50},
};
System.out.println(Arrays.toString(s));
System.out.println(Arrays.deepToString(d));
}
}
The code above generates the following result.
Home »
Java Tutorial »
Java Data Type »
Java Tutorial »
Java Data Type »