我这样设计问题出在哪里,想在share1双向链表里加入一个id为1,price为50的share
class Share{
private int no;//ID
private int price;//Price
public Share(int no, int price ) {
this.no = no;
this.price = price;
}
}
import java.util.LinkedList;
public class Main {
public static void main(String[] args) {
LinkedList<Share> share1 = new LinkedList<Share>();
share1.add(1,50); //在share1双向链表里加入一个id为1,price为50的share
System.out.println(share1);
}
}