gpt4 book ai didi

java - 错误: constructor AcceptedFriendAction in class AcceptedFriendAction cannot be applied to given types;

转载 作者:行者123 更新时间:2023-12-01 14:55:45 25 4
gpt4 key购买 nike

当我编译代码时,出现以下错误消息:“错误: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;
}
}

再次感谢您:)

最佳答案

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

代码应如下所示:

AcceptedFriendAction action = new AcceptedFriendAction(socialInterest, new DateTime(), suggestComment, newFriend);

关于java - 错误: constructor AcceptedFriendAction in class AcceptedFriendAction cannot be applied to given types;,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14320304/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com