Menu
Question Index
...

What will be the output of the following program?

public class ReRecursion {
    public static void main(String[] args) {
        System.out.println(Fact.fact(5));
    }
}
class Rec {
    static long recur(long n) {
        long result = n > 1 ? (recur((recur((recur((recur(n - 1)) - 1)) - 1)) - 1) * (recur(n - 1))) : 1;
        return result;
    }
}


120
1
Some other output
Output can not be determined
Compilation Error or Runtime Error

Doubts

Problems

Topic: Behavior Of Java Classes Using Methods

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App