摘要: 1、read() 功能:读取单个字符的个数,如果已经读完的话会返回-1 (其范围从 0 到 65535 ) 例子如下: byte[] buf = new byte[1024]; int len; while ((len = in.read(buf)) > 0) { //单个读取计数,直到结束返回-1 阅读全文
posted @ 2017-01-09 12:00 快乐的骑马哥 阅读(3008) 评论(0) 推荐(0)
摘要: 递归二字顾名思义就是:递过去,归回来、所以我索性叫它做有借有还吧。 下面的例子由c而来: public class Main { public static void main(String[] args) { fun(1); } public static void fun(int n) { Sy 阅读全文
posted @ 2017-01-07 22:07 快乐的骑马哥 阅读(1866) 评论(0) 推荐(0)
摘要: 1、replace() String str= "mesquite in your cellar" str.replace('e', 'o') returns "mosquito in your collar" 由此可知replace是全替换的。 建议:单引号全部改为双引号,避免编译出错,有时可能操 阅读全文
posted @ 2016-12-28 16:43 快乐的骑马哥 阅读(4682) 评论(0) 推荐(0)
摘要: 从字面意思可知这个方法就是比较的意思。 所以该方法有如下两种情况: 1、比较前后的两个字符不相同: (1) String str = "Hello World"; String anotherString = "hello world"; System.out.println( str.compar 阅读全文
posted @ 2016-12-28 12:49 快乐的骑马哥 阅读(169) 评论(0) 推荐(0)