Machine-translated by Google. Questions are authored in English.
Top

Discussion

Which modifier combination is illegal on a field?

  • A.static volatile boolean ready;
  • B.private static final int MAX = 10;
  • C.volatile final int limit;
  • D.private volatile int count;

Answer: C

volatile and final cannot be combined: final says the value never changes after construction, while volatile exists to publish changes, so the pair is contradictory and the compiler rejects it. Every other combination shown is legal.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.