摘要: <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/P 阅读全文
posted @ 2020-02-23 14:42 愚钝的Tom 阅读(282) 评论(0) 推荐(0) 编辑
摘要: public class GC { public static GC SAVE_HOOK = null; public static void main(String[] args) throws InterruptedException { // 新建对象,因为SAVE_HOOK指向这个对象,对象 阅读全文
posted @ 2019-04-19 17:15 愚钝的Tom 阅读(360) 评论(0) 推荐(0) 编辑
摘要: 服务端程序: public class Demo { public static void main(String[] args) { // TODO 自动生成的方法存根 try { ServerSocket server =new ServerSocket(6666); Socket client 阅读全文
posted @ 2019-03-06 16:36 愚钝的Tom 阅读(403) 评论(0) 推荐(0) 编辑
摘要: public class Demo { //通过管道完成文件的拷贝 public static void main(String[] arg) { PipedInputStream in =new PipedInputStream(); PipedOutputStream out; try { ou 阅读全文
posted @ 2019-03-04 17:56 愚钝的Tom 阅读(194) 评论(0) 推荐(0) 编辑
摘要: 1、在start之前,setDaemon。 该现场就成为守护线程了。 2、守护现线程并不是主线程结束,子线程(守护线程)也跟着结束。而是守护线程在没有用户线程运行的情况伴随着JVM退出而结束。 示例代码: public class Demo { public static void main(Str 阅读全文
posted @ 2019-03-01 14:02 愚钝的Tom 阅读(301) 评论(0) 推荐(0) 编辑
摘要: 转自:https://www.cnblogs.com/bakari/p/3562244.html 一、Java Properties类 Java中有个比较重要的类Properties(Java.util.Properties),主要用于读取Java的配置文件,各种语言都有自己所支持的配置文件,配置文 阅读全文
posted @ 2019-02-27 16:28 愚钝的Tom 阅读(211) 评论(0) 推荐(0) 编辑
摘要: 1、Stack继承自Vector。遵从先进后出的规则。 2、Stack 是线程同步的。(map、List、Set是线程不同步的,需要在外部封装的时候来同步) 试例代码: public static void main(String[] args) { // TODO 自动生成的方法存根 //stac 阅读全文
posted @ 2019-02-27 14:49 愚钝的Tom 阅读(261) 评论(0) 推荐(0) 编辑
摘要: 1、使用默认的TreeMap 构造函数,其中key值需要有比较规则。 2、使用默认的TreeMap 构造函数,Key中添加自定义类型,自定义类型必须继承Comparator。 3、使用比较器类来来实现排序,自定义类型不用来继承Comparator 试例代码: public class Demo { 阅读全文
posted @ 2019-02-27 14:07 愚钝的Tom 阅读(7188) 评论(0) 推荐(0) 编辑
摘要: HashMap遍历方式包含以下4种: 1、遍历KeySet,再通过Key来getValue。 2、使用entrySet的迭代器。 3、foreach entrySet的方式。 3、foreache values的方式。 试例代码: public class Demo { public static 阅读全文
posted @ 2019-02-27 13:16 愚钝的Tom 阅读(2304) 评论(0) 推荐(0) 编辑
摘要: 1、TreeSe自带排序的set,没有重复元素。 2、TreeSet 如果构造函数中没有使用比较器,那在装载的对象类中要实现Comparable 接口。 3、TreeSet 使用初始化比较器的方式。 试例代码: public class Demo { public static void main( 阅读全文
posted @ 2019-02-27 10:19 愚钝的Tom 阅读(624) 评论(0) 推荐(0) 编辑