摘要: Error : java.net.SocketException: Connection reset by peer: socket write error Error : java.net.SocketException:由peer重置的连接:套接字写入错误提供文件时 以上为出错部分的Code。 阅读全文
posted @ 2018-05-04 10:49 LeafLay 阅读(103) 评论(0) 推荐(0) 编辑
摘要: interrupt () 可以终止线程,略显粗暴。(比起stop() 还是温柔一些 = = .orz ) 介绍一种不用interrupt()终止线程的方法。 in thread main i =1000 0 in thread main i =2000 1 2 3 in thread main i 阅读全文
posted @ 2018-04-17 12:46 LeafLay 阅读(89) 评论(0) 推荐(0) 编辑
摘要: (0,0) (2.7182798,3.14159) (2,3) (2,3) 源程序如上图,动态绑定(多态) 是针对的非static 、非final的成员方法,隐藏针对的是成员变量和static 方法。(针对且只针对) 只有Override (重写) 才会进行动态绑定,隐藏(即子类声明和父类同名同类型 阅读全文
posted @ 2018-04-16 20:48 LeafLay 阅读(131) 评论(0) 推荐(0) 编辑
摘要: 查看Java API Document 时,对 java.io.ObjectOutputStream 中其中一个方法 public void writeUnshared(Object obj) thorws IOException ,其中 back-reference 好奇, back - refe 阅读全文
posted @ 2018-04-13 18:47 LeafLay 阅读(83) 评论(0) 推荐(0) 编辑
摘要: Collection Sort 、binarySearch Warning : 运行结果显示: [b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10] [a0, a1, a2, a3, a4, a5, a6, a7, a8, a9] [a5, a1, a2, a9 阅读全文
posted @ 2018-04-07 12:23 LeafLay 阅读(96) 评论(0) 推荐(0) 编辑
摘要: 错结果如图所示 代码无打错名字等问题,出错原因,初学容器,使用Collection 时,忘记引入包。 出错原因: < 比较运算符只能对于基本数据类型进行操作,而上述代码中 ‘ < ’ 两侧为类型变量(非基本数据类型) 进行比较时,采用compareTo().通过返回值来判断大小。 p.s. a.co 阅读全文
posted @ 2018-04-06 16:07 LeafLay 阅读(177) 评论(0) 推荐(0) 编辑
摘要: 一、对象转型 Casting true true true false bigyellow true true yellow 1、对象转型:父类引用指向子类对象,如上述代码中,Animal a = new Dog("bigyellow" , "yellow"); Animal 的引用类型变量a 指向 阅读全文
posted @ 2018-04-06 16:04 LeafLay 阅读(1027) 评论(0) 推荐(0) 编辑
摘要: Java 常见Waring 、 Error 错误: 需要class, interface或enum Error: class, interface, or enum is required. 出现错误的原因: 1、文件后缀名, 并非以 .java 作为文件后缀名 ( 看到类似错误,记下来以便参考)。 阅读全文
posted @ 2018-04-03 10:03 LeafLay 阅读(127) 评论(0) 推荐(0) 编辑
摘要: 1、数据类型分为内置类型和引用类型,等等基础概念,不再详细阐述,很多博客上面有进行介绍。 2、Something About Integer Java (JVM)中看到不带小数点的数(即整数),则默认将该值分为int 类型。若需存储足够大的整数,=> long number = 88888888L 阅读全文
posted @ 2018-04-01 15:19 LeafLay 阅读(283) 评论(0) 推荐(0) 编辑
摘要: StringBuffer与String的相互转换 1、将StringBuffer转换成String——StringBuffer类成员toString函数可将其转换成String类型。实例如下: StringBuffer stringBuffer = new StringBuffer(“Hello W 阅读全文
posted @ 2018-04-01 15:18 LeafLay 阅读(146) 评论(0) 推荐(0) 编辑