Home » Java Programming » Declarations and Access Control

Which of the following class level (nonlocal) variable declarations will not compile?

Correct Answer: private synchronized int e;

Explanation:

Option C will not compile; the synchronized modifier applies only to methods.


Option A and B will compile because protected and transient are legal variable modifiers. Option D will compile because volatile is a proper variable modifier.


Next Question→

More Questions from Declarations and Access Control

Discussion & Comments

No comments yet. Be the first to comment!
Join Discussion