我在尝试编译应用程序时遇到了一些错误。
这是我的界面......
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: ");
}
}
这些是我在尝试编译时遇到的错误......
public class Displaymessage
:--- Syntax error on token "class", @ expected
在第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
在最后一行,} :- Syntax error on token "}", delete this token
我无法弄清楚这些错误。任何帮助都会很棒。
答案 0 :(得分:2)
public class DisplayMessage() {
摆脱()
。
答案 1 :(得分:0)
从类定义中删除()
。
答案 2 :(得分: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: ");
}
}
应该是这样的。希望这会有所帮助。