0

编译代码时,出现以下错误消息:“错误:AcceptedFriendAction 类中的构造函数 AcceptedFriendAction 不能应用于给定类型;” 在第 23 行( AcceptedFriendAction 动作 [...] )

我读到那是因为我的构造函数中有一个字符串,但我真的不明白如何安排它。如果有人可以帮助我?感谢您的时间和理解。

public class AcceptedFriendAction extends SocialAction {

    private static final long serialVersionUID = -692737;

    @ManyToOne
    private User newFriend;

    public AcceptedFriendAction(final SocialInterest socialInterest,
            final DateTime date, final String suggestComment, final User newFriend) {
    super(socialInterest, date, suggestComment);
    this.newFriend = newFriend;
    }

    public User getNewFriend() {
        return newFriend;
    }

    public static AcceptedFriendAction add(final SocialInterest socialInterest, 
            final String suggestComment, final User newFriend) {

        AcceptedFriendAction action = new AcceptedFriendAction(socialInterest, new DateTime(), newFriend, suggestComment);
        action.save();
        return action;
    }
}

再次感谢你 :)

4

1 回答 1

1

你放错了第三个和第四个参数

代码应如下所示:

AcceptedFriendAction action = new AcceptedFriendAction(socialInterest, new DateTime(), suggestComment, newFriend);
于 2013-01-14T14:30:37.867 回答