Upto-Dream
2016-12-14 05:20
采纳率: 50%
浏览 1.8k
已采纳

linkedlist toarray()和toarray(T[] a)

linkedlist toarray()和toarray(T[] a)的用法和区别,求人案例说明下
LinkedList link=new LinkedList();
Shop1 one=new Shop1(001,"苹果",3.2);
Shop1 two=new Shop1(002,"火龙果",3.88);
Shop1 three=new Shop1(003,"草莓",1.2);
Shop1 three1=new Shop1(003,"草莓",1.2);
Shop1 four=new Shop1(003,"小草",1.4);

    String a=Arrays.toString(link.toArray());
    System.out.println(a);

    Object[] x=link.toArray(new Object[5]);
    for(int i=0;i<link.size();i++){
        System.out.println(x[i]);
    }
    toarray()和toarray(T[] a)
    输出的是乱码
    怎么样才能转换输出
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

相关推荐 更多相似问题