首页上一页 1 下一页尾页 1 条记录 1/1页
Java经典编程300例。
发表在Java图书答疑
2013-07-25
是否精华
是
否
版块置顶:
是
否
Scanner scanner = new Scanner(System.in);
输完这句话时,eclipse左侧有提示
multiple markers at this line
Resource leak:scanner is never closed
Resource leak:scanner is never closed
是怎么回事呢。
源代码如下(有少许改动)
System.out.println("请输入一个数字:");
Scanner scanner = new Scanner(System.in);//此行出现提示
Long number = scanner.nextLong();
String string = (number % 2 == 0)?"偶数":"奇数";
System.err.println("这个数是一个"+string);
输完这句话时,eclipse左侧有提示
multiple markers at this line
Resource leak:scanner is never closed
Resource leak:scanner is never closed
是怎么回事呢。
源代码如下(有少许改动)
System.out.println("请输入一个数字:");
Scanner scanner = new Scanner(System.in);//此行出现提示
Long number = scanner.nextLong();
String string = (number % 2 == 0)?"偶数":"奇数";
System.err.println("这个数是一个"+string);