栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

java第十章

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

java第十章

An aggregation relationship is usually represented as a data field in the aggregating class

A solid diamond is attached to the class of the composing class to denote the aggregation relationship with the composed object.

2 is the output of Integer.parseInt("10", 2)

To create an instance of BigDecimal for 454.45, use new BigDecimal("454.45");

To add BigInteger b1 to b2, you write b1=b2.add(b1);

In JDK 1.5, you may directly assign a primitive data type value to a wrapper object. This is called auto boxing.

在JDK 1.5中,可以直接将原始数据类型值赋给包装器对象。这叫做自动装箱。

Two strings with same contents aren't ALWAYS allocated to the same object.

Assume s is "ABCABC", the method s.replace('A', 'a') returns a new string "aBCaBC".

new String(a) is the correct statement to return a string from an array a of characters

ssume s is "ABCABC", the method s.toCharArray() returns an array of characters.

The replace method in the String class replaces a character in the string. But it doesn't change the content of the string.(It create a new string.)

 system.out.print("Hi, ABC, good".matches("ABC ") + " ");——>false

     system.out.println("Hi, ABC, good".matches(".*ABC.*"));——>true

You can append a string to a string buffer if the resulting new string exceeds the capacity.

To get a string from the StringBuffer, you use the toString method.

strBuf.charAt(strBuf.length() - 1) returns the last character in a StringBuilder variable named strBuf.

Assume StringBuilder strBuf is "ABCDEFG", after invoking strBuf.insert(3, "RRRR"), strBuf contains "ABCRRRRDEFG".

If your string does not require any changes, you should use String rather than StringBuffer to improve performance.

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/978688.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号