06 2013 档案

Junit 测试 简明教程
摘要:类中方法出现的情况无bug的方法出现bug的方法未写好的方法超时的方法单元测试创建步骤1. 创建一个测试对象2. 注意下面的注解@Before@Test(expected = ArithmeticException.class)@Test(timeout=1000)@Ignore("xxxxxxxxx")@After3. assertEquals(期待的结果, 实际的结果);可选的其他方案一、import static org.junit.Assert.assertEquals;import org.junit.Test;import org.junit.runner.Ru 阅读全文

posted @ 2013-06-13 22:01 Knuth_档案 阅读(226) 评论(0) 推荐(0) 编辑

Map接口
摘要:Map 模拟数学上 函数 概念HashMap TreeMap LinkedHashMap1. 支持键、值、键值对进行迭代2. 迭代期间安全删除项目3. put get containsKey containsValue size isEmptykeySet entrySet values 三种遍历方式中选择哪种方式比较好呢?(写法按照下面图片的写法来做)HashMap 建议选用keySettreeMap 建议选用treeSet 阅读全文

posted @ 2013-06-13 15:13 Knuth_档案 阅读(125) 评论(0) 推荐(0) 编辑

Best practices for Exception Handling
摘要:public void consumeAndForgetAllExceptions(){ try { ...some code that throws exceptions } catch (Exception ex){ ex.printStacktrace(); }}一旦异常被抛出,正常程序执行将被挂起并且控制权将被转向catch块,catch块捕获异常后仅仅抑制它,catch块执行之后继续程序的执行,好像什么事情都没有发生。public void someMethod() throws Exception{}空的函数体怎么能抛出一个异常呢?Ja... 阅读全文

posted @ 2013-06-09 22:04 Knuth_档案 阅读(161) 评论(0) 推荐(0) 编辑

group by 多个字段
摘要:insert into test values(1,'a','甲')insert into test values(1,'a','甲')insert into test values(1,'a','甲')insert into test values(1,'a','甲')insert into te... 阅读全文

posted @ 2013-06-06 21:26 Knuth_档案 阅读(217) 评论(0) 推荐(0) 编辑

导航

点击右上角即可分享
微信分享提示