Quizzes
Site Language: English
Українська
English
Русский
Programming Tests
Login
Sign Up
Programming Tests
Theory
Snippets
Papers
Landing
Android
Prices
FAQ
Cosmo Story
Terms and Conditions
Privacy Policy
Cookies Policy
Send Feedback
comparator
:
Content language: English
Русский
Which java.util.Set realizations sorts the elements by their natural order (or on Comparator basis).?
comparator
What will be printed out as a result of the following code execution? import java.util.TreeSet; public class TestTreeSet { public static void main(String[] args) { TreeSet<Item> set = new TreeSet<Item>(); set.add(new Item(2)); set.add(new Item(5)); set.add(new Item(2)); System.out.println(set); } static class Item { int n; Item(int n) { this.n = n; } public String toString() { return "Item " + n; } } }
comparator
← Prev
1
Next →
Sign Up Now
or
Subscribe for future quizzes