www.HadoopExam.com

HadoopExam Learning Resources

Following are the Oracle Java and Oracle SQL Products Provided by HadoopExam Learning Resources
Free Core Java 1Z0-808 Training Java 1Z0-808 Questions and Answers Java 1Z0-809 Questions and Answers Questions for Oracle 1Z0-060 : Upgrade to Oracle Database 12c Administrator Oracle Database 12c: SQL Fundamentals

Question 9: You have been given below code, what is the expected behavior when executed?

Question 9: You have been given below code, what is the expected behavior when executed?

package com.hadoopexam;

import java.util.Locale;

class Welcome {

public static void main(String[] args) {

Locale l1 = new Locale("en"); 

Locale l2 = new Locale("en", "in"); 

Locale l3 = new Locale("th", "TH", "TH"); 

Locale l4 = new Locale(l3); 

System.out.println(l1 + " " + l2 + " " + l3 + " " + l4);

}

}

1. It will give compile time error.

2. It will give run time error.

3. It will compile and run with output as  "en en_IN th_TH_TH_#u-nu-thai th_TH_TH_#u-nu-thai"

4. It will compile and run with output as "en en_IN th_TH_TH_#u-nu-thai th_TH_TH_#u-nu-IN"

Correct Answer : 1 Exp : You cannot create Locale using another locale instance.

The Locale class provides three constructors: 

     Locale(String language)

     Locale(String language, String country)

     Locale(String language, String country, String variant)

 

These constructors allow you to create a Locale object with language, country and variant, but you cannot specify script or extensions. 

Factory Methods

The method forLanguageTag creates a Locale object for a well-formed BCP 47 language tag. 

I have cleared my Java 1Z0-808 Certification exam with 92% using this simulator

I have cleared my Java 1Z0-809 Certification exam with 96% using this simulator

You have no rights to post comments

You are here: Home Oracle Java 1Z0-809 Question 9: You have been given below code, what is the expected behavior when executed?