看板java
标 题Re: [问题] Scanner
发信站月光海洋BBS (Sat Apr 15 10:56:21 2006)
转信站ptt!ctu-reader!news.nctu!mobbs
遇到这种情况
我都是直接读一整行 然後再用split()切割
有人有其它好方法吗?
※ [email protected] wrote:
> 要怎麽让Scanner读两个用逗号分隔的int? ex: 6,7
> 我试着用delimiter但是似乎步行
> public class test
> {
> public static void main(String args[]){
> Scanner input=new Scanner(System.in).useDelimiter("\\s*l\\s*");
> System.out.println(input.nextInt());
> System.out.println(input.nextInt());
> input.close();
> }
> }
> 只能读出一个数
> 请问有什麽办法哩
> 谢谢罗
--
◣ ███ ███ ☆ Post by Pistachi
◢█ ▉▉█ █▇█ ★ From 61-64-181-47-adsl-kao.dynamic.so-ne
◥█◤ ﹉ ﹍ ﹋ 月光海洋BBS 《mobbs.stut.edu.tw》 163.26.220.130