I get these weird characters when I try to print out a vector element!

前端 未结 4 746
青春惊慌失措
青春惊慌失措 2021-01-21 15:29

I\'m using Netbeans. When I run the program below, I get this as output [I@de6ced! How come?

import java.util.Arrays;
import java.util.Vector;

publ         


        
4条回答
  •  深忆病人
    2021-01-21 16:32

    Integer[] a = new Integer[1];
    a[0] = new Integer(5);
    List list = Arrays.asList(a);
    System.out.println(list.get(0));
    

    The above works as you would expect.

    So it looks like the "int" array is treated like an Object and not an array of Integers. In other words auto boxing doesn't seem to be applied to it?

提交回复
热议问题