Question: Consider the following Java method: public void fun 3 ( int n ) { if ( n > 0 ) { System.out.print ( 0

Consider the following Java method:
public void fun3(int n){
if (n >0){
System.out.print("0");
fun3(n -2);
System.out.print("1");
fun3(n -2);
}
}
What is the output of fun3(6)? To show your work, clearly show the
recursive calls that give the output of fun3(4)(i.e., the first call to
fun3(6-2)). Once you show what fun3(4) is, you can simply give the
output for fun3(6)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!