You are working on a project that has an existing function called getNextId() which returns an int.
You are given the following code:
while (true) {
int id = getNextId();
if (id == -1) {
break;
}
System.out.println(id);
}
System.out.println("Done");
Which of the following statements are TRUE about this code? Choose the correct answer:
A. There is no way the code will exit from the loop, and Done will never be printed because the condition is while(true).
B. If getNextId() returns -1, it will exit the loop (or "break" out of the loop) and print Done.
C. If getNextId() returns -1, it will throw an exception on the line that says break and Done will not be printed.
D. This code will not compile because of the infinite loop