2013-01-14 64 views
0

當我編譯我的代碼時,我有這個錯誤消息:「錯誤:類AcceptedFriendAction中的構造函數AcceptedFriendAction不能應用於給定的類型;」在第23行(AcceptedFriendAction行動[...])錯誤:構造函數AcceptedFriendAction類中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; 
    } 
} 

再次謝謝:)

+0

再次閱讀你的代碼,看看秩序傳遞的參數匹配構造函數接受的參數。 –

+0

是啊,我很笨,我知道...:/ – user1969970

回答

1

你遺失了第三和第四參數

代碼應該是這樣的:

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

哦,我的窩 - '非常感謝你 – user1969970

相關問題