Question 5
Back to Exercise
The program below does not compile. Which statement correctly describes the problem?
public class Main {
static final String APP_NAME;
public static void main(String[] args) {
System.out.println("running");
}
}
- A String cannot be static
- B A blank static final field must be assigned in its declaration or in a static block Correct
- C main must print APP_NAME
- D final fields must be private
Correct Answer: Option B
Add = "LearnFrenzy" or a static { APP_NAME = …; } block.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!