20145109 《Java程序设计》第八周学习总结

Chapter 15 API

java.util.logging package

The constructor of Logger class is protected. If Logger instance is needed, must use static function getLogger().

e.g.

Logger logger = Logger.gerLogger("cc.openhome.Main");

//Logger logger = Logger.gerLogger(Main.class.getName());
//If you add '.class' you can get the class instance, then '.getName' can get the full name

ResourceBundle

for changeable information, it is considerable to move it out of program.

.properties must be put in classpath.

829945-20160424215828351-715026975.png

829945-20160424215850835-1105386964.png

Locale

It contains two points: Language code & Country code.

Language code:

ca: Catalan
zh: Chinese

Country code:

IT: Italy
TW: Taiwan
CN: China

Regular Expression

Character class:

[ ] means if any:

    for (String token : "Justin1Monica2Irene3".split("[123]")) {
        out.println(token);
    }
  • means from to:

    [1-5], [a-z]

^ means without:

[^abc]

Greedy quantifier, Reluctant quantifier

Greedy quantifier will find the suitable words as longer as possible.

\d{4}-\d{6} equals \d\d\d\d-\d\d\d\d\d\d
xfooxxxxxxxfo if compared by .*foo, it 's the full

Reluctant quantifier will find the suitable words as shorter as possible.

xfooxxxxxxxfo if compared by .*?foo, there will be two: xfoo and xxxxxxxfo

Possessive quantifier will eat all suitable words and won't back-up

xfooxxxxxxxfo if compared by .?+foo, there's none left, because .+ is suitable for xfooxxxxxxxfo, so nothing left.

转载于:https://www.cnblogs.com/Christen/p/5428674.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值