码迷,mamicode.com
首页 >  
搜索关键字:println    ( 5792个结果
System.getProperty()方法大全
System.out.println("java版本号:" + System.getProperty("java.version")); // java版本号 System.out.println("Java提供商名称:" + System.getProperty("java.vendor")).....
分类:其他好文   时间:2014-09-11 12:31:11    阅读次数:213
Java:聚集操作
你使用集合的目的是什么?当然不是为了简单的存储然后置之不理,你是为了从集合取数据和操作数据的。 再次考虑前一篇文章提到的背包类, 如果要打印所有背包的重量, for(Package p : packages) System.out.println(p.getWeight()); 遍历,可以使用"forEach"这一聚集操作, packages.stream()...
分类:编程语言   时间:2014-09-11 01:14:51    阅读次数:278
模板方法模式之抽象类继承
Test.java package?com.demo_type.pattern.template; public?class?Test?{ public?static?void?main(String[]?args)?{ System.out.println("制备咖啡..."); RefreshBeverage?coffee?=?new...
分类:其他好文   时间:2014-09-10 23:59:51    阅读次数:484
一个Java线程小例子(仿火车票售卖)
public class MyThread extends Thread{ private static int ticket=100; public void run(){ for(int i=0;i0) System.out.println...
分类:编程语言   时间:2014-09-10 23:40:51    阅读次数:247
java try catch finally 问题
今天写程序遇到一个问题,就是需要在while循环抛异常的时候把数据return出去。发现try块放在while循环外面是正确的。 privatestaticvoidtest5(){ intcount=1; while(count<100){ count++; try{ }catch(Exceptione){ }finally{ System.out.println("final:"+c..
分类:编程语言   时间:2014-09-10 19:47:31    阅读次数:241
swift练习(1)
最近参照Swift文档和http://www.chinaz.com/swift/chapter1/02_a_swift_tour.html的学习整理////main.swift//TestSwift1////Createdbyzqlon14-9-10.//Copyright(c)2014年TU.Allrightsreserved.//importFoundationprintln("Hello,World!")println("HelloSwift")varmyVariable=42..
分类:编程语言   时间:2014-09-10 12:43:41    阅读次数:361
golang 模版 管道
//读取模板template/index.html的内容 b, err := ioutil.ReadFile("template/index.html") if err != nil { log.Println(err) } s := string(b) t, _ := template.New("").Funcs(template.FuncMap{"ShowS":strin...
分类:其他好文   时间:2014-09-10 11:00:50    阅读次数:253
鸡兔同笼问题java暴力求解算法
public class A{ public static void main(String[] args) int HEAD=50; int FOOT=120; for(int x=0;X int y=HEAD-x; if(x*2+y*4==FOOT){ System.out.println("x="+x +","+y="+y); } } }...
分类:编程语言   时间:2014-09-10 09:41:00    阅读次数:327
学习request获得路径getContextpath, getServletPath,getRequestUri
http://localhost:8080/news/main/list.jsp 则执行下面向行代码后打印出如下结果: 1、 System.out.println(request.getContextPath()); 打印结果:/news 2、System.out.println(request.getServletPath()); 打印结果:/main/list.jsp ...
分类:其他好文   时间:2014-09-09 23:07:59    阅读次数:593
第五章      高级搜索
5.1搜索排序publicvoidseacher(StringqueryContion,intnum,Sortsort){ try{ IndexSearchersearcher=newIndexSearcher(indexReader); QueryParserparser=newQueryParser(Version.LUCENE_35,"contents",analyzer); Queryquery=parser.parse(queryContion); System.out.println("..
分类:其他好文   时间:2014-09-09 13:47:49    阅读次数:269
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!