qq_43919601 2021-07-10 14:38 采纳率: 50%
浏览 57

java用接口实例化和直接实例化有什么区别?

Collection hs1 = new HashSet<>();
Set hs2 = new HashSet<>();
HashSet hs3 = new HashSet<>();

请问以上三种方法实例化出来的对象有什么区别?

  • 写回答

3条回答 默认 最新

  • qq_43919601 2021-07-10 14:39
    关注
        Collection<Character> hs1 = new HashSet<>();
        Set<Character> hs2 = new HashSet<>();
        HashSet<Character> hs3 = new HashSet<>();
    
    评论

报告相同问题?

问题事件

  • 创建了问题 7月10日