All Flashcards

0
Q

Can ListResourceBundles class be private or protected?

A

No it must be public, due to reflection.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
1
Q

The key name is a case sensitive in resource bundle and must exactly match?

A

Yes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

A fully qualified Resource Bundle has the following name…

A

packagequalifier.bundlename + “” + language + “” + country + “” + (variant + “#” | “#”) + script + “-“ + extensions
like localization.examples.AppBundle_en_US_Oracle_exam

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

The getBundle() method takes a ResourceBundle.Control object as an additional parameter. By extending this ResourceBundle.Control class and passing the instance of that extended class to the getBundle() method, you can change the default resource bundle search process or read from non-standard resource bundle formats (such as XML files

A

Yes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

If the locale of the ResourceBundle.getLocale() name is empty, it means Java has loaded the global resource bundle

A

Yes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

NumberFormat and DateFormat—are both inherited from the Format base class; these classes are part of the java.text package and are useful for making locale-aware software

A

Yes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

When using NumberFormat to parse Strings we must caught…

A

ParseException

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the difference between parse() method from the format() method of Format class

A

The parse() method is meant for reading numbers provided as String and trying to convert it to Number. The format() method is used for printing the values according to the values set in the NumberFormat object.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How can we specify the fraction digits in NumberFormat?

A

numberFormat.setMaximumFractionDigits(2)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Important Methods in the NumberFormat Class

A
String format(double number) 
String format(long number) 
Number parse(String source)
static Locale[] getAvailableLocales() 
static NumberFormat getInstance() 
Currency getCurrency() 
static NumberFormat getCurrencyInstance() 
static NumberFormat getIntegerInstance() 
static NumberFormat getPercentInstance()
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Important Methods in the DateFormat Class

A
String format(Date date) 
Date parse(String source)  
String format(Date date) 
static Locale[] getAvailableLocales() 
static DateFormat getInstance() 
static DateFormat getDateInstance() 
static DateFormat getTimeInstance() 
static DateFormat getDateTimeInstance()
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Which are the available style formats of DateFormat class?

A

DateFormat.SHORT, DateFormat.MEDIUM, DateFormat.LONG, DateFormat.FULL, DateFormat.DEFAULT

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

The DateFormat has three overloaded factory methods…

A

getDateInstance(), getTimeInstance(), and getDateTimeInstance()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

If you want to create your own format or pattern for processing the date or time, can you do that?

A

Yes, the SimpleDateFormat class provides this facility.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Here is the list of important letters and their meanings for creating patterns for dates…

A
G     Era (BC/AD) 
y     Year 
Y     Week year 
M     Month (in year)
 w     Week (in year
W     Week (in month) 
D     Day (in year) 
d     Day (in month) 
F     Day of week in month 
E     Day name in week 
u     Day number of week
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

There are many ways to get or create a Locale object…

A

Option 1: Use the constructor of the Locale class: Locale(String language, String country, String variant): Locale locale1 = new Locale(“it”, “”, “”);

Option 2: Use the forLanguageTag(String languageTag) method in the Locale class: Locale locale2 = Locale.forLanguageTag(“it”);

Option 3: Build a Locale object by instantiating Locale.Builder and then call setLanguageTag() from that object: Locale locale3 = new Locale.Builder().setLanguageTag(“it”).build();

Option 4: Use the predefined static final constants for locales in the Locale class: Locale locale4 = Locale.ITALIAN