内容是看了设计模式之禅,然后自己写个文档总结到一起,便于查看。 单例模式:(程序运行过程中只能有一个类的对象) 单例模式主要是对构造方法进行私有化 private,防止外部通过 new方法 创建实体类。针对该类中的方法尽量使用static修饰,便于访问。 public class Singleton ...
分类:
其他好文 时间:
2021-04-21 12:14:09
阅读次数:
0
public class Main { public static void main(String[] args) throws Exception { // 两个CompletableFuture执行异步查询: CompletableFuture<String> cfQueryFromSina ...
分类:
编程语言 时间:
2021-04-21 12:05:09
阅读次数:
0
UDP 发短信 : 不需要连接但是需要知道对方的地址 发送消息 //不需要连接服务器 public static void main(String[] args) throws Exception { //1.建立一个socket DatagramSocket datagramSocket = ne ...
分类:
其他好文 时间:
2021-04-21 11:50:41
阅读次数:
0
1. Overview JasperReports is an open source reporting library that enables users to create pixel-perfect reports that can be printed or exported in ma ...
分类:
编程语言 时间:
2021-04-21 11:48:33
阅读次数:
0
1:使用 插件 geolocator ,官网 https://pub.dev/packages/geolocator 2:按照官网配置,代码照抄 static Future<FlutterLocation> determinePosition() async { bool serviceEnable ...
分类:
移动开发 时间:
2021-04-21 11:46:27
阅读次数:
0
CountDownLatch 每次当线程调用countDownLatch.countDown()方法时,会对计数器减1,减到0,countDownLatch.await()放行 public class CountDownLatchTest { public static void main(Str ...
分类:
其他好文 时间:
2021-04-20 15:06:35
阅读次数:
0
需求:点击按钮,显示文本和隐藏文本 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>jQuery 入门</title> <script src="/static/jQuery-1.11/jquery-1.11 ...
分类:
Web程序 时间:
2021-04-20 14:39:19
阅读次数:
0
1.饿汉式,这种方式不推荐,会造成资源的浪费。 public class Hungry { private Hungry(){ } private static Hungry hungry = new Hungry(); public static Hungry getInstance(){ ret ...
分类:
其他好文 时间:
2021-04-20 14:07:56
阅读次数:
0
public class Main { public static void main(String[] args) { test test = new test(); test.xxx(new zi()); } } class fu{ public void x(){ System.out.pri ...
分类:
其他好文 时间:
2021-04-20 14:06:09
阅读次数:
0
public class StatePattern { public static void main(String[] args) { Context context=new Context(); for (int i = 0; i < 10; i++) { context.handle(); } ...
分类:
其他好文 时间:
2021-04-19 16:06:54
阅读次数:
0