---
title: "Understanding recursive method. Help!"  
description: "Understanding recursive method. Help!"  
author: "Royce Roy"  
published: 2015-04-29  
updated: 2015-04-29  
canonical: https://www.mindstick.com/forum/23157/understanding-recursive-method-help  
category: "java"  
tags: ["java"]  
reading_time: 1 minute  

---

# Understanding recursive method. Help!

This [code](https://yourviews.mindstick.com/view/85458/alan-turing-the-mastermind-behind-cracking-the-enigma-code-during-world-war-ii) is working(it's [purpose](https://yourviews.mindstick.com/view/247/no-fail-policy-failing-its-purpose) is to return the [product](https://www.mindstick.com/articles/75385/full-product-keys) of n [odd](https://yourviews.mindstick.com/view/86337/delhi-odd-even-scheme-is-active-again-what-is-it-and-why-it-is-in-the-news) numbers). My [problem](https://yourviews.mindstick.com/view/81399/tackling-the-problem-of-unemployment-during-corona-pandemic) is, I do not understand how exactly works. What goes after what, how exactly the [values](https://www.mindstick.com/forum/327/sum-textbox-values) are caluclated and multiplied and what happens in the return after n==1. [Sorry](https://yourviews.mindstick.com/view/81321/ekta-kapoor-s-sorry-is-not-acceptable) if I am asking for too much, but can someone [explain](https://www.mindstick.com/forum/157854/what-is-system-debugging-explain-some-system-debugging-tools-used-in-modern-computer-systems) this to me in [detail](https://www.mindstick.com/forum/157518/what-is-svm-algorithm-and-also-explain-it-in-detail)?

```
public static int multiplyOdds (int n) {        System.out.println(n);        if(n==1){        return 1;                 }else return  multiplyOdds(n-1) * (n*2-1);                      }
```

## Replies

### Reply by Anonymous User

well, there is not so much to explain. Just write out in ful what happens\
when you issue 'multiplyOdds(3)'.\
\
When n = 3 we get\
(since 3 != 1):\
(2 * 3 - 1) * multiplyOdds(2) = 5 * multiplyOdds(2) =\
(since 2 != 1):\
5 * (2 * 2 - 1) * multiplyOdds(1) = 5 * 3 * multiplyOdds(1) =\
(since n == 1):\
5 * 3 * 1\
= 15\
\


---

Original Source: https://www.mindstick.com/forum/23157/understanding-recursive-method-help

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
