Are you taking CLEP classes? Try clep.ai
| preferred AP College board partner for AP classes
easy Solved by 4 students

Java Keyword Case Sensitivity

< Prev
Next >

Consider the Factorial class shown below. Which of the following statements best explains why this code will fail to compile?

public class Factorial {
    public static int factorial(int n) {
        if (n <= 1)
            return 1;
        else
            Return n * factorial(n - 1);
    }
    
    public static void main(String[] args) {
        System.out.println(factorial(5));
    }
}
A

The multiplication operation should be enclosed in parentheses.

B

The main method must return an integer value.

C

The use of ‘Return’ with an uppercase ‘R’ is incorrect; Java requires the lowercase keyword ‘return’.

D

There is no proper base case defined for termination.

Hint
Did You Know?
Explain Why
Explain All Answers
Check Answer
Show Correct Answer
Report Question
Mark for review

Question Leaderboard

Rank
User
Correct Count
Attempt Count
Total Time
Score
#1upadhgau00022 0m 00s 200
#2imeanbusinessreplit11 0m 00s 100
#3singhris00011 0m 29s 71
#4isaact.taylor5211 1m 50s -10
Items per page:
10
1 – 4 of 4
No comments yet. Be the first to comment!

AI Tutor

How can I help?

APFIVE © 2020.
Email: apfive@apfive.org|Privacy Policy|FAQ