UOP PRG421 Week 4 Discussion Latest 2020

Question # 00786627 Posted By: rey_writer Updated on: 12/10/2020 12:19 PM Due on: 12/10/2020
Subject Education Topic General Education Tutorials:
Question
Dot Image

PRG421 Java Programming II

Week 4 Discussion

DQ1 Benefits and Drawbacks of Concurrency

The purpose of this discussion is to explore concurrency, which refers to threads that run alongside each other during program execution, as opposed to running serially, or one after the other, and to discuss potential drawbacks and problems associated with concurrency.

Java™ provides built-in support for concurrent programming by allowing the running of multiple threads concurrently within a single program. A thread, also called a lightweight process, is a single sequential flow of programming operations with a definite beginning and end. During the lifetime of a thread, there is only a single point of execution. A thread by itself is not a program, because it cannot run on its own, instead all threads must run within a program.

Research and discuss with your classmates the benefits of concurrency in Java™. What are the potential drawbacks?

DQ2 Localization

The purpose of this activity is to provide you with an explanation for, and some experimentation with, the concept of localization via the Locale object.

Localization is the process of adapting a program so that it displays information in the way local users need to see it, and is important for any program running on the web where users from virtually any country in the world can access it.

A program that has been effectively localized displays currency in pounds and dates in day/month/year format to United Kingdom audiences, currency in dollars and dates in month/day/year format to United States audiences, etc.

Localization is particularly significant in that it allows for organizing all user-facing text so that it display text in different languages, as necessary.

Note: This course does not address localization in detail, however it does introduce the topic and demonstrate how setting a Locale object allows Java™ programmers to take advantage of pre-built formatting.

For this supporting activity, you will run an existing Java™ program to see how changing the Locale object automatically changes date formats.

Download the linked Java™ file, or cut-and-paste it into a new Java™ project in NetBeans using a name of your choosing.

Examine the Java™ code, paying special attention to the main() method, in which three Locale objects are created: one for France, one for Germany, and one for the United States. Notice that passing different Locale objects to the same methods (e.g., showDateStyles(), showTimeStyles(), and showBothStyles()) results in a customized display.

Note: Refer to the linked list of standardized codes to see which codes represent which countries.

Insert the following code at the beginning of the main() method, just after the opening curly brace:

Date now = new Date();

System.out.println("Here is default date format: " +

DateFormat.getInstance().format(now));

Save the program, and run it in NetBeans again. What locale does the Java™ runtime environment assume by default: U.S. or European? (Hint: Typically, the Java™ runtime environment sets the default locale on download/install based on your computer system.)

 

Dot Image
Tutorials for this Question
  1. Tutorial # 00786543 Posted By: rey_writer Posted on: 12/10/2020 12:23 PM
    Puchased By: 2
    Tutorial Preview
    The solution of UOP PRG421 Week 4 Discussion Latest 2020...
    Attachments
    UOP_PRG421_Week_4_Discussion_Latest_2020.ZIP (18.96 KB)

Great! We have found the solution of this question!

Whatsapp Lisa