Skip to content

Commit

Permalink
Update Java Question (#2295)
Browse files Browse the repository at this point in the history
Q95
  • Loading branch information
GitLearner-begin authored Sep 30, 2021
1 parent ae8595b commit f705e12
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions java/java-quiz.md
Original file line number Diff line number Diff line change
Expand Up @@ -1341,3 +1341,27 @@ class Main {
- [x] contains unordred elements
- [ ] contains unique elements
- [ ] contains sorted elements

#### Q95. What is the output?

import java.util.*;

public class Main {
public static void main(String[] args)
{
PriorityQueue<Integer> queue = new PriorityQueue<>();
queue.add(4);
queue.add(3);
queue.add(2);
queue.add(1);

while (queue.isEmpty() == false) {
System.out.printf("%d", queue.remove());
}
}
}

- [ ] 1 3 2 4
- [ ] 4 2 3 1
- [X] 1 2 3 4
- [ ] 4 3 2 1

0 comments on commit f705e12

Please sign in to comment.