• Post Reply Bookmark Topic Watch Topic
  • New Topic

Factorial Calculator  RSS feed

 
Matthew Moreno
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If i have the code, call it code # 1

It prints fine and is as desired. However, I am new to methods and classes so Im trying to make the following code, call it code # 2, work

This code doesn't work, however. I don't think its a problem with my variable declarations or calculations. I think I am not using the right syntax to output num, or is this not my problem?
 
Tim Cooke
Marshal
Posts: 3873
233
Clojure IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you say "The code doesn't work", what exactly do you mean by that?
 
Mike. J. Thompson
Bartender
Posts: 689
17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Take a look at your first program. Which line do you think is writing out the result?

Can you change the second program to contain that line?
 
Matthew Moreno
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I see, I made another integer and set it equal to the method then printed it. Thanks for help, making me ask the question to myself helped me understand.
 
Liutauras Vilda
Marshal
Posts: 4657
319
BSD
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Matthew Moreno wrote:making me ask the question to myself helped me understand.
It called Rubber duck debugging (<- link)
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!