Correct Answer : Get Lastest Questions and Answer : Explanation: : The final keyword can be applied for classes, methods, and variables. You cannot extend a final class, you cannot override a final method, and you cannot change the value of a final variable once it is initialized.
Question : Which two statements are true about localizing an application? A. Support for new regional languages does not require recompilation of the code. B. Textual elements (messages and GUI labels) are hard-coded in the code. C. Language and region-specific programs are created using localized data. D. Resource bundle files include data and currency information. E. Language codes use lowercase letters and region codes use uppercase letters.
Correct Answer : Get Lastest Questions and Answer : Explanation: A locale represents a language, culture, or country; the Locale class in Java provides an abstraction for this concept. . Each locale can have three entries: the language, country, and variant. You can use standard codes available for language and country to form locale tags. There are no standard tags for variants; you can provide variant strings based on your need. . The getter methods in the Locale class-such as getLanguage(), getCountry(), and getVariant()-return codes; whereas the similar methods of getDisplayCountry(), getDisplayLanguage(), and getDisplayVariant() return names. . The getDefault() method in Locale returns the default locale set in the JVM. You can change this default locale to another locale by using the setDefault() method. . There are many ways to create or get a Locale object corresponding to a locale: . Use the constructor of the Locale class. . Use the forLanguageTag(String languageTag) method in the Locale class. . Build a Locale object by instantiating Locale.Builder and then call dsetLanguageTag() from that object. . Use the predefined static final constants for locales in the Locale class.
Question : Which statement is true about java.util.stream.Stream?
1. A stream cannot be consumed more than once.
2. The execution mode of streams can be changed during processing.
4. A parallel stream is always faster than an equivalent sequential stream
Correct Answer : Get Lastest Questions and Answer : Explanation: The call to parallel() method changes the execution mode to parallel stream. It is possible to change the execution mode of a stream after it is created, and it does not result in throwing any exceptions.
5. TreeMap is always sorted by Keys. Map can not have duplicate keys, but it can have duplicate values.
java.util.TreeMap.TreeMap()
Constructs a new, empty tree map, using the natural ordering of its keys. All keys inserted into the map must implement the Comparable interface. Furthermore, all such keys must be mutually comparable: k1.compareTo(k2) must not throw a ClassCastException for any keys k1 and k2 in the map. If the user attempts to put a key into the map that violates this constraint (for example, the user attempts to put a string key into a map whose keys are integers), the put(Object key, Object value) call will throw a ClassCastException.