开发者

Syntax error on token "void", @ expected

开发者 https://www.devze.com 2023-03-12 15:04 出处:网络
Does anyone know what causes the following errors? This seems like a pretty standard construct to me. Thanks (errors then code)

Does anyone know what causes the following errors? This seems like a pretty standard construct to me. Thanks (errors then code)

public class Emailer {

    import java.io.*;
    import java.net.*;

    public void getFile(String dlFileName,String saveFileName) {

    }

    public static void main(String[] args) {
        // TODO Auto-generated method stub

    }

}

Error was :

Syntax error on token "void", @ expected
Syntax error on token "]", invalid (
Syntax error, insert "]" to complete ArrayAccess
Syntax error, insert ")" to complete SingleMemberAnnotation
Syntax error, insert "enum Identifier" to complete Enu开发者_如何转开发mHeader


Your imports need to come before your class declaration.

import java.io.*;
import java.net.*;

public class Emailer {

    // ...Emailer code down here


Move your imports above your Emailer class declaration.


Importing Java API's should be before class/interface declaration.

This order should be followed.

<package declaration>
<import declaration>
<class declaration> 
0

精彩评论

暂无评论...
验证码 换一张
取 消