-3

尝试编译我的应用程序时出现许多错误。

这是我的界面...

public interface userMessage {
    public enum DisplayMessageID {
        VALID, CMD_ERR, LOAD_ERR, 
        SAVE_ERR, DELETE_ERR, CONVERT_ERR, 
        FORMAT_ERR
    }

    String subuserMessage(DisplayMessageID DispMess);
}

这是我的一堂课...

package terminal;

public  class UserCommunication implements userMessage {

    public DisplayMessageID DisplayMessageID;

    public UserCommunication (DisplayMessageID displaymessageid ) {
        this.DisplayMessageID  = displaymessageid ;
    }

    // a method for Displaying messages
    public String  subuserMessage(DisplayMessageID DispMess) {          
        switch (DispMess) {
            case CMD_ERR : 
                System.out.println("Terminal Sw Module cannot able to intrepret the input Command");
            break;

            case LOAD_ERR :    
                System.out.println("Controller reports there is problem in fetching the file:" + "\n" +
                    "1 Check if the source file exits in Database" + "\n" +
                    "2 Check if Source path is right" + "\n" +
                    "3 Check if you have access to Database");
            break;

            default:
                System.out.println("VALLIDD.");
            break;  

        }
    return "ddd";
    }
}

这是我的主要程序...

package terminal;

import terminal.userMessage.DisplayMessageID;

public class DisplayMessage() {

    public static void main(String[] args) {
        UserCommunication user_comm_to_terminal = new UserCommunication(DisplayMessageID.LOAD_ERR);
        System.out.println("Height of rectOne: ");
    }
}

这些是我在尝试编译时遇到的错误......

  1. 在线, public class Displaymessage--- Syntax error on token "class", @ expected
  2. 在线,public static void main(String[] args) :-

    Multiple markers at this line
    - Syntax error on token "void", @ expected
    - Syntax error, insert "enum Identifier" to complete EnumHeader
    - Syntax error, insert "]" to complete ArrayAccess
    - Syntax error on token "]", invalid (
    - Syntax error, insert ")" to complete SingleMemberAnnotation 
    
  3. 最后一行,} :- Syntax error on token "}", delete this token

我无法弄清楚这些错误。任何帮助都会很棒。

4

3 回答 3

2
public class  DisplayMessage() {

摆脱().

于 2012-05-30T14:10:56.260 回答
0
public class DisplayMessage {

public static void main(String[] args) {


    UserCommunication user_comm_to_terminal = new UserCommunication(DisplayMessageID.LOAD_ERR);

     System.out.println("Height of rectOne: ");



}

}

应该是这样的。希望这可以帮助。

于 2012-05-30T14:18:00.283 回答
0

()从类定义中删除。

于 2012-05-30T14:11:09.787 回答