+ 1
What will be the output when Method(3) is invoked?
void Method(int c) { if(c==0) System.out.println(" "); else { System.out.println("Hello"+c); Method(--c); System.out.println(" "+c); } }
9 Answers
+ 1
If you want explanation or reason , briefly
The last Method(0) call will complete first by printing 0 by last statement. And first call Method(3) last..
If you have problem in executing, then run it playground and share link here. Then some correct your mistakes if any....
+ 2
If you want output then,Why cant run this in code play code? pls Clearly specify what you need there ?
Any way the output
It give as
Hello3
Hello2
Hello1
0
1
2
It include spaces also as in your code...
+ 1
I said compilation error....
How can you expect output without proper details? Sry It's not possible by me.
edit : √
+ 1
Read the comments there, in that program. Explanation is there. And i posted link in code comments which gives you full information..
hope that clears...
0
Its definition doesn't matter.
Answer is asked of this code only,it doesn't need entire program
0
Sorry! I have corrected the question.
Answer it again.
0
I understood 👍
I was also getting this output but I was a little bit confused.
This question was asked by my computer teacher.
0
Can you explain that Robo program that I have recently seen on your timeline
- 1
Where is Method(3) definition?
It compile error raises..
void(int c) not a proper function specification. ..
what you are trying here? can you explain?
edited : question √