• Post Reply Bookmark Topic Watch Topic
  • New Topic

how to fix thus error message "this method must return a result of type int"  RSS feed

 
Ranch Hand
Posts: 52
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Marshal
Posts: 4051
239
Clojure IntelliJ IDE Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Danny, welcome to the Ranch!

When you declare that something of type int is returned from a method, as you have in your fnum and snum methods, you must return something. As you have found it is an error if you do not return anything. For example:

You must return something of type int using the return statement.

Also, you nearly got the code tags right but I fixed them up for you this time. I encourage you to use the "Preview" feature when composing your message to see if it looks alright before submitting. It's saved me from embarrassment many a time.
 
Danny Alphones
Ranch Hand
Posts: 52
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot "Tim Cooke"!!! i was able to get rid of my error. Again, thanks a lot.
 
Tim Cooke
Marshal
Posts: 4051
239
Clojure IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Awesome! How did you do it?
 
Tim Cooke
Marshal
Posts: 4051
239
Clojure IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Continuing here by the looks of it: https://coderanch.com/t/677268/java/code-runs
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!