Dump array contentTag(s): Language
JDK1.5+
Convert the array to a List and then convert to String. This technique works only with classes and not with primitives like int or double.
public class Test {
public static void main(String args[]) {
String s[] = {"a", "b", "c", "d"};
System.out.println(java.util.Arrays.asList(s).toString());
// output
// [a, b, c, d]
}
}
public class Test {
public static void main(String args[]) {
String s[] = {"a", "b", "c", "d"};
double d [][]= {
{0.50, 0.70, 0.40, 0.60},
{0.50, 1.10, 0.50, 0.80}
};
System.out.println(java.util.Arrays.toString(s));
System.out.println(java.util.Arrays.deepToString(d));
// output
// [a, b, c, d]
// [[0.5, 0.7, 0.4, 0.6], [0.5, 1.1, 0.5, 0.8]]
}
}
public class Test {
public static void main(String args[]) {
String s[] = {"a", "b", "c", "d"};
for (String element : s) {
System.out.println(element);
}
}
}
mail_outline
Send comment, question or suggestion to howto@rgagnon.com
Send comment, question or suggestion to howto@rgagnon.com