摘要: 三个特点:调用本类属性,调用本类方法(普通和构造),表示当前对象(最难理解的概念) 1.使用this调用本类属性 观察如下代码 class Person{ private string name ; private int age // setter getter 无参构造略 public Pers 阅读全文
posted @ 2017-09-02 19:17 竹之轩 阅读(110) 评论(0) 推荐(0) 编辑
摘要: 范例:实现字符串的拆分处理 全拆分 String str = "hello world hello mldn"; String result [] = str.split(" "); for(int x = 0 ; x < result.length ; x++) { System.out.prin 阅读全文
posted @ 2017-09-02 16:04 竹之轩 阅读(9546) 评论(0) 推荐(0) 编辑
摘要: 最简单的就是contains()方法 String str = "helloworld"; System.out.println(str.contains("world")); // true jdk 1.5 后才有的 System.out.println(str.indexOf("world")) 阅读全文
posted @ 2017-09-02 14:26 竹之轩 阅读(1295) 评论(0) 推荐(0) 编辑
摘要: 字符串与字节数组的转换 String str = "helloworld"; byte data[] = str.getBytes(); for(int x = 0 ; x < data.length ; x++) { data[x]- = 32 ; System.out.print(datd[x] 阅读全文
posted @ 2017-09-02 11:05 竹之轩 阅读(1460) 评论(0) 推荐(0) 编辑