摘要: 一、单例模式定义 单例模式确保某个类只有一个实例,而且自行实例化并向整个系统提供这个实例。在计算机系统中,线程池、缓存、日志对象、对话框、打印机、显卡的驱动程序对象常被设计成单例。这些应用都或多或少具有资源管理器的功能。每台计算机可以有若干个打印机,但只能有一个Printer Spooler,以避免 阅读全文
posted @ 2019-05-03 20:10 jason小蜗牛 阅读(4060) 评论(0) 推荐(0) 编辑
摘要: //二分查找的前提是有序的数。public class BinarySearch { public static void main(String[] args) { int[] arr = {1, 2, 4, 5, 6, 8, 9, 10}; System.out.println(binarySe 阅读全文
posted @ 2019-04-28 15:33 jason小蜗牛 阅读(176) 评论(0) 推荐(0) 编辑
摘要: //选择排序//基本思想:从原始数组中寻找最小的那个数,然后与第一个数交换,依次类推public class SelectionSort { public static void main(String[] args) { int[] arr = {1, 4, 15, 63, 33, -1, 0, 阅读全文
posted @ 2019-04-28 14:56 jason小蜗牛 阅读(217) 评论(0) 推荐(0) 编辑
摘要: //插入排序//从第一个元素开始,每个数往前插入,后一个数与前一个数相比较,如果后一个数小于前一个数,则将后一个数往前移位。public class InsertSort { public static void main(String[] args) { int[] arr = {-2, 52, 阅读全文
posted @ 2019-04-28 14:50 jason小蜗牛 阅读(198) 评论(0) 推荐(0) 编辑
摘要: //两数交换不用中间变量public class TwoChange { public static void main(String[] args) { int a = 3, b = 5; //第一种方式采用加减法实现 /* a = a + b; b = a - b; a = a - b;*/ / 阅读全文
posted @ 2019-04-27 16:32 jason小蜗牛 阅读(320) 评论(0) 推荐(0) 编辑
摘要: 快速排序是冒泡排序的改进,效率比较高,基本思想也是两两相比较。 阅读全文
posted @ 2019-04-27 16:24 jason小蜗牛 阅读(198) 评论(0) 推荐(0) 编辑
摘要: //冒泡排序//冒泡排序要经过N-1步的中间排序才能排完,效率较低public class BublleSort { public static void main(String[] args) { int[] arr = {1, 56, 36, 74, 2, 6, 3, 21, 5}; bubbl 阅读全文
posted @ 2019-04-27 14:57 jason小蜗牛 阅读(182) 评论(0) 推荐(0) 编辑
摘要: Unknown system variable 'query_cache_size'] with root cause 出现这个错误是因为mysql连接数据库的版本不对, 阅读全文
posted @ 2019-04-16 20:43 jason小蜗牛 阅读(425) 评论(0) 推荐(0) 编辑
摘要: 通配符的匹配很全面, 但无法找到元素 'mvc:annotation-driven' 的声明 错误原因是springmvc中的约束信息不对 阅读全文
posted @ 2019-04-16 20:41 jason小蜗牛 阅读(1656) 评论(0) 推荐(0) 编辑
摘要: 常见的404 not found资源路径不存在,遇到了路径没有错,但老是报404,错误,检查了好几遍都不知道错在哪儿。 分析原因有以下几种: 1.资源路径有可能真的错了,注意相对路径和绝对路径,./和../的区别,一个是当前目录,一个上一级目录,/是根目录。 2.重新启动服务器。再试试看访问 3.如 阅读全文
posted @ 2019-04-09 08:22 jason小蜗牛 阅读(263) 评论(0) 推荐(0) 编辑