1、字符串
String s = new String(“123”)不如String s = “123”效率高。
字符串连接操作StringBuilder效率比较高。
StringBuffer是线程安全的,StringBuider非线程安全。
String相等: ==、!=是比较对象参照是否相同,equal是比较内容是否相同。
StringBuilder相等: 应该sb1.toString( ).contentEquals(sb2)。用equal是不对的。
String大小: compareTo( )
数值 ⇒ String:String.valueOf( ) 或 Integer.toString( )等
String ⇒ 数值:Integer.parseInt(String,进制) 等
2、访问属性
private
protected
public
transient: 非序列化
final: 不能再赋值
static: 类里的static项目在类的所有实例里通用
volatile: 线程间值同步
3、类成员的访问属性修饰符
Normal
0
7.8 pt
0
2
false
false
false
MicrosoftInternetExplorer4
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:標準の表;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:"Times New Roman";
mso-fareast-font-family:"Times New Roman";
mso-ansi-language:#0400;
mso-fareast-language:#0400;
mso-bidi-language:#0400;}
修饰词 |
本类 |
同一个包的类 |
继承类 |
其他类 |
private |
√ |
× |
× |
× |
无(默认) |
√ |
√ |
× |
× |
protected |
√ |
√ |
√ |
× |
public |
√ |
√ |
√ |
√ |
abstract |
抽象函数 |
|||
final |
不能覆盖 |
|||
static |
类函数 |
|||
Synchronized |
获得同步Lock |
|||
native |
和C++联合开发用,可使用DLL接口 |
|||
strictftp |
精确浮点数 |
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:標準の表;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:10.0pt;
font-family:"Times New Roman";
mso-fareast-font-family:"Times New Roman";
mso-ansi-language:#0400;
mso-fareast-language:#0400;
mso-bidi-language:#0400;}