Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Error message

 
James Palmer
Ranch Hand
Posts: 36
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,i have this method in a class:
public int getAnswer(int a) {
a = (number1 + number2);
answer = a;
return answer;
}


I use it in my main method and it gives the error message:
getAnswer(int) in class cannot be applied to ().
Any ideas?Thanks
 
Darin Niard
Ranch Hand
Posts: 118
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you happen to be calling getAnswer(), without a parameter? Because, that would be your problem.

Your method needs to be passed an int in order for it to work. However, in this case, you shouldn't be using a parameter at all, since all you are doing is assigning something to it. Declare the int inside your method.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic