• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

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

 
Ranch Hand
Posts: 52
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Sheriff
Posts: 4889
317
IntelliJ IDE Python Java Linux
  • 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
Sheriff
Posts: 4889
317
IntelliJ IDE Python Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Awesome! How did you do it?
 
Tim Cooke
Sheriff
Posts: 4889
317
IntelliJ IDE Python Java Linux
  • 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
    Bookmark Topic Watch Topic
  • New Topic