- 博客(3)
- 收藏
- 关注
转载 stringbuilder的常用方法
一、创建Stringbuilder对象StringBuilder strB = new StringBuilder();1、append(String str)/append(Char c):字符串连接System.out.println("StringBuilder:"+strB.append("ch").append("111").append('c'));//return "StringBu...
2018-04-10 19:45:49 1586
转载 scanner类的方法
next() 与 nextLine() 区别next():1、一定要读取到有效字符后才可以结束输入。 2、对输入有效字符之前遇到的空白,next() 方法会自动将其去掉。3、只有输入有效字符后才将其后面输入的空白作为分隔符或者结束符。 next() 不能得到带有空格的字符串。nextLine(): 1、以Enter为结束符,也就是说 nextLine()方法返回的是输入回车之前的所有字符。 2、可...
2018-04-10 19:42:03 209
转载 this的用法
this表示类实例本身。this的用法1、表示对当前对象的引用!public class A{ public A getA(){ return this;//表示获取当前实例本身 }}2、表示类的成员变量,而非函数参数,注意在函数参数和成员变量同名是进行区分!public class A{ private int a = 0;//位置1 public A getA(int...
2018-04-10 19:40:15 131
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人