F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

View Compilation Error

0_0_39323521_25147\Main.java:2: 错误: 需要class, interface或enum
    public static int sum(int n) {
                  ^
0_0_39323521_25147\Main.java:7: 错误: 需要class, interface或enum
        int s = 0;
        ^
0_0_39323521_25147\Main.java:10: 错误: 需要class, interface或enum
        for (int i = 0; i < n; i++) {
        ^
0_0_39323521_25147\Main.java:10: 错误: 需要class, interface或enum
        for (int i = 0; i < n; i++) {
                        ^
0_0_39323521_25147\Main.java:10: 错误: 需要class, interface或enum
        for (int i = 0; i < n; i++) {
                               ^
0_0_39323521_25147\Main.java:15: 错误: 需要class, interface或enum
            a[i] = currentDigit;
            ^
0_0_39323521_25147\Main.java:18: 错误: 需要class, interface或enum
            s += currentDigit;
            ^
0_0_39323521_25147\Main.java:21: 错误: 需要class, interface或enum
            n /= 10;
            ^
0_0_39323521_25147\Main.java:22: 错误: 需要class, interface或enum
        }
        ^
0_0_39323521_25147\Main.java:27: 错误: 需要class, interface或enum
        }
        ^
0_0_39323521_25147\Main.java:30: 错误: 需要class, interface或enum
    }
    ^
0_0_39323521_25147\Main.java:33: 错误: 需要class, interface或enum
    public static void sumTest() {
                  ^
0_0_39323521_25147\Main.java:36: 错误: 需要class, interface或enum
        int expectedResult = 45;
        ^
0_0_39323521_25147\Main.java:39: 错误: 需要class, interface或enum
        int result = sum(n);
        ^
0_0_39323521_25147\Main.java:42: 错误: 从发行版 1.4 开始, 'assert' 是一个关键字, 但不能用作标识符
        assert result == expectedResult;
        ^
  (请使用 -source 1.3 或更低版本以将 'assert' 用作标识符)
0_0_39323521_25147\Main.java:45: 错误: 需要class, interface或enum
        System.out.println("结果: " + result);
        ^
0_0_39323521_25147\Main.java:46: 错误: 需要class, interface或enum
    }
    ^
17 个错误


Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-16 12:48:41, Gzip enabled