类似于C# using() java 语法

 

From :   https://www.infoq.com/news/2010/08/arm-blocks

 

try(Jedis jedis = jedisPool.getResource()){
String key = "testKey2";
jedis.set(key,"fasdfasdfasdfasdfasdf");

String data = jedis.get(key);

System.out.println(i+"--" + data);
}
 
 
try() …
 
 
posted @ 2016-12-21 09:26  张保维  阅读(655)  评论(0编辑  收藏  举报