Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
帮帮忙 程序正确运行 提交却出错误 求教Compile Error Main.java:5: class HangOver is public, should be declared in a file named HangOver.java public class HangOver { ^ 1 error 程序如下 package HangOver; import java.util.Scanner; public class HangOver { public static void main(String[] args) { float n, length, getNumber = 0; Scanner getNumber1 = new Scanner(System.in); getNumber = getNumber1.nextFloat(); for (n = 1, length = 0; length < getNumber; n++) { length = length + 1 / (n + 1); } System.out.println(n - 1); } } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator