20145239 Du Wenshu "Java Programming" 8th Week study Summary

Source: Internet
Author: User
Tags configuration settings locale string format git client

20145239 Java Programming 8th Week learning Summary Textbook Learning content summary General API
    • Log API

      1. Java.util.logging package provides a log function related classes and interfaces, the starting point for using the log is the logger class, the logger class's constructor is labeled protected, not java.util.logging the same package class cannot be created directly with new, will be allowed to use logger static party Law, such as: Logger logger = Logger.getLogger("cc.openhome.Main") .

      2. The way to obtain logger: Logger logger = Logger.getLogger("Main.class.getName") .

      3. The same namespace-level logger, the parent logger configuration will be the same, each logger after processing their own log action, will propagate to the parent logger, so that the parent logger can also process the log.

    • Specify the log level

1. In the absence of any configuration settings, the default LOGGER instance, the level must be greater than or equal to the Logger.global-logger-name namespace LOGGER instance set Level.info, can output information.

2.Handler can be set by Setlevel () information, the following information is not only to set the level of logger to level.info, but also to handler level set to Level.info.

    • Using handler and Formatter
    1. Memoryhandler does not format the log information, the information is staged in the memory buffer until it exceeds the size to output the information to the specified destination handler.
    2. When establishing a Filehandler specified pattern string, you can use "%h" to represent the user's root directory, or you can use "%t" to obtain the system staging directory, or use "%g" to automatically number the document.

    • Customizing handler, formatter, and filter

Custom formatter, which can inherit formatter after the operation of the abstract method format (), this method will pass in LogRecord, storing all the log information.

    • Using Logging.properties

The logger configuration can be changed by logging.properties.

Internationalization Basics
    • Internationalization

In the case of non-modification of the application, according to different users directly using different languages, date format, such design considerations called internationalization, referred to as i18n.

    • Using ResourceBundle
    1. For text messages that may change in the future, consider moving the information outside of the program and using ResourceBundle for information binding.
    2. .propertiesThe document must be placed under the path setting of the classpath, the key/value pair is written in the document, and then the key can be used in the program to get the pairing.
    3. The static Getbundle () method of ResourceBundle takes an instance of ResourceBundle, given the argument name is the main file name of the information document. Getbundle () will automatically find the corresponding. Properties document, and after getting the ResourceBundle instance, you can use the GetString () to specify the key to get.
    • Using locale
    1. The three criteria for internationalization are region (Locale) information, resource bundle (Resource bundle) and base name.
    2. The area information represents a specific geographic, political, or cultural area, which is specified by a language code (represented by two lowercase letters) and an optional region code (denoted by two uppercase letters). The corresponding class of region information is locale, such as Locale locale=new Locale("zh","TW"); .
    3. The resource bundle includes information about a specific region.
    4. Each resource bundle that represents the same set of information but different regions share the same base name.
Rules table Introduction
    1. The rule expression is used primarily for character, string format comparisons, including literal meaning characters and meta characters. literal meaning characters are characters that are compared by literal meaning, and metacharacters are non-literal comparisons that have different meanings in different contexts.
    2. If you have a string, you can use the split () method of string, which returns a string array that consists of the individual substrings after the cut.
Pattern and Matcher
    1. The Java.util.regex.Pattern instance is the representative object of the rule representation in the JVM, and the pattern's constructor is marked as private and must be obtained through the static method compile () of the pattern.
    2. After you have obtained an instance of pattern, you can use the split () method to cut the specified string in accordance with a regular representation.

Stringjoiner, arrays new API
    1. The new join () static method of string allows you to specify a comma-delimited connection between each string.
    2. Arrays new Parallelprefix (), Parallelsetall () and Parallelsort () methods, Parallelsort () methods, you can divide the specified array into sub-arrays and sort them in parallel. Then merge the sort.

This week's code hosting

Other (sentiment, thinking, etc., optional)

I used to be lazy, do not want to see the learning sister git tutorial, has been using the method of Web copy managed code. Today calm down to follow the steps to set up a step-by-step git, in the constant encounter problems and ask the students finally the first time

This week's code is hosted using a GIT client. This feeling of joy is I did not think of, in fact, many things are not so difficult to imagine, as long as willing to drill, Ken next time, there will be some harvest!

Learning progress Bar /Cumulative) new/cumulative)
lines of code (newBlog volume (Learning time (new/cumulative) Important growth
Goal 5000 rows 30 Articles 400 hours
First week 150/150 1/2 15/15
Second week 350/500 1/3 20/35
Third week 400/900 1/4 35/70
Week Four 490/1890 1/5 40/110
Week Five 592/2882 1/6 30/140
Week Six 686/4368 2/8 30/170
Seventh Week 708/4776 2/10 15/185
Eighth Week 846/4822 2/12 15/200
Resources
    • Java Learning Notes (8th Edition)
    • Java Learning Note (8th Edition) Learning Guide

20145239 Du Wenshu Java Programming 8th Week of study summary

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.