Question: Which statements about the following application are correct? (Choose two.) A. The TicketTaker constructor does not compile. B. The performJob() method does not compile. C.

Which statements about the following application are correct? (Choose two.) 

import java.util.concurrent.atomic. *; import java.util.stream.*; public class TicketTaker { long ticketsSold; final

A. The TicketTaker constructor does not compile.

B. The performJob() method does not compile.

C. The class compiles.

D. The first number printed is consistently 100.

E. The second number printed is consistently 500.

F. A ConcurrentModificationException is thrown at runtime.

import java.util.concurrent.atomic. *; import java.util.stream.*; public class TicketTaker { long ticketsSold; final Atomic Integer ticketsTaken; public TicketTaker() { ticketsSold = 0; ticketsTaken = new AtomicInteger (0) ; } public void performJob() { IntStream. iterate (1, p-> p+1) .parallel() .limit (100) .forEach(i -> ticketsTaken.getAnd Increment ()); IntStream.iterate(1, q ->q+1) .parallel() .limit (500) .forEach (i > ++ticketsSold); System.out.print(tickets Taken+" "+ticketsSold); } } } public static void main(String[] matinee) { new TicketTaker () .performJob();

Step by Step Solution

3.41 Rating (157 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Statement C is correct The class compiles without any compilation errors Statement F is correct A Co... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Oracle Questions!