Java: Converting a set to an array for String representation

前端 未结 6 983
遇见更好的自我
遇见更好的自我 2021-02-05 02:08

From Sun\'s Java Tutorial, I would have thought this code would convert a set into an array.

import java.util.*;

public class Blagh {
    public static void mai         


        
6条回答
  •  北荒
    北荒 (楼主)
    2021-02-05 02:38

    As dfa mentioned, you can just replace:

    System.out.println(array);
    

    with...

    System.out.println(Arrays.toString(array));
    

提交回复
热议问题