package com.test;
public class Test {
public static void main(String[] args) {
// print();
// print1();
// print3();
// print4();
}
private static void print4() {
int[] arr = {1,2,3};
System.out.println(arr); //[I@179dce4
System.out.println(arr.toString()); //[I@179dce4
String s = String.valueOf(arr);
System.out.println(s); //[I@179dce4
}
private static void print3() {
byte[] arr = {'a','b','c'};
System.out.println(arr); //[B@179dce4
System.out.println(arr.toString()); //[B@179dce4
String str = new String(arr);
System.out.println(str.toString()); //abc
String s = String.valueOf(arr);
System.out.println(s); //[B@179dce4
}
private static void print1() {
int[] arr = {'a','b','c'};
System.out.println(arr); // [I@179dce4
System.out.println(arr.toString()); //[I@179dce4
String s = String.valueOf(arr);
System.out.println(s); //[I@179dce4
}
private static void print() {
char[] arr = {'a','b','c'};
System.out.println(arr); //abc
System.out.println(arr.toString()); //[C@95cfbe
String str = new String(arr);
System.out.println(str.toString()); //abc
String s = String.valueOf(arr);
System.out.println(s); //abc
}
}
|
|