String、StringBuffer、StringBuilder知识
2016-01-30 17:25
501 查看
String
字符串一旦被初始化就不可以被改变。"abc"是一个对象。
String s1="abc"; String s2=new String("abc");区别:在内存中,s1代表一个对象,s2代表两个对象。
StringBuffer
字符串缓冲区。长度是可变化的。
可以操作多种数据类型。
最终会通过toString方法变成字符串。
StringBuilder
StringBuffer是线程同步。StringBuilder是线程不同步。速度快.
单线程建议使用StringBuilder,多线程建议使用StringBuffer。
除了线程与StringBuffer有区别,别的都相同。
相关文章推荐
- LinearLayout,RelativeLayout和UI优化的总结
- 工作队列(workqueue)
- smp boot up sequence
- Guideline--LM指南------------LeapMotion
- Java之GUI编程(一)
- UIImage渲染颜色
- [心得] 如何利用liquibase進行資料庫版本控制 - 基礎觀念
- priority_queue(优先队列)用法总结
- MySQL优化之慢日志分析(Anemometer+Pt-query-digest)
- Message Queue - MQ Intro
- jsp中request的常见使用方法
- UIGestureRecognizer手势
- PHP获取request payload(在header中)的方法
- LeetCode 303 Range Sum Query - Immutable(范围总和查询-永久不变)(*)
- [iOS]UICollectionView循环滚动功能的实现思路
- UIColor创建UIImage备忘
- Hue 3.9 on HDP2.3.4 安装备忘
- Wunder Fund Round 2016 B. Guess the Permutation
- CF618B - Guess the Permutation
- codeforces Wunder Fund Round 2016 (Div. 1 + Div. 2 combined) B Guess the Permutation