![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
java 基础
内涵大表哥
这个作者很懒,什么都没留下…
展开
-
for 与foreach 的简单应用
常见的实现方法: 1.for循环: for(int i = 0; i for(int i = 0, size = list.size(); i 2.foreach 增强for循环 for(Object obj : list)第一种可以对列表进行修改第二种只能对列表进行读取,无法修改原创 2016-07-06 13:48:09 · 202 阅读 · 0 评论 -
单例与多例
1.什么多例每一个请求都会创建一个新对象,比如说是Struts2 action 2.什么单例所有的请求都用一个对象来处理,比如sessionFactory 或者是service 或dao 层 3.为什么用单例和多例之所以用单例,是因为没必要每个请求都新建一个对象,这样子既浪费CPU又浪费内存; 之所以用多例,是为了防止并发问题;即一个请求改变了对象的状态,此原创 2016-07-28 13:41:05 · 398 阅读 · 0 评论 -
Comparator 与Comparable 异同
1. Comparator 和 Comparable 相同的地方他们都是java的一个接口, 并且是用来对自定义的class比较大小的,什么是自定义class: 如 public class Person{ String name; int age }.当我们有这么一个personList,里面包含了person1, person2, persion3.....原创 2016-07-18 16:13:02 · 131 阅读 · 0 评论 -
mysql 查询null
mysql 查询null值select * from table where colum is null;查询非null 有两种select * from table where column != 'null';select * from table where colum is not null;原创 2016-09-02 10:43:43 · 355 阅读 · 0 评论