Which line of code, inserted inside the increment () method, will increment the value of c?

Given:
import java.util.concurrent.atomic.AtomicInteger;
public class AtomicCounter {
private AtomicInteger c = new AtomicInteger(0);
public void increment() {
// insert code here
}
}
Which line of code, inserted inside the increment () method, will increment the value of c?
A. c.addAndGet();
B. c++;
C. c = c+1;
D. c.getAndIncrement ();

Download Printable PDF. VALID exam to help you PASS.

Leave a Reply

Your email address will not be published. Required fields are marked *


The reCAPTCHA verification period has expired. Please reload the page.