小编Ha *_*Kim的帖子

我无法在我的代码中实例化类Integer的对象(Java)

我正在使用ListNode作为内部类创建一个类,Doubly Linked List.

public class DoublyLinkedList<Integer> {

    /** Return a representation of this list: its values, with adjacent
     * ones separated by ", ", "[" at the beginning, and "]" at the end. <br>
     * 
     * E.g. for the list containing 6 3 8 in that order, return "[6, 3, 8]". */
    public String toString() {
        String s;

        ListNode i = new ListNode(null, null, *new Integer(0)*);
Run Code Online (Sandbox Code Playgroud)

为什么我得到错误,无法实例化类型Integer

java generics class

2
推荐指数
1
解决办法
2540
查看次数

标签 统计

class ×1

generics ×1

java ×1