嘗試編譯我的應用程序時,出現了一些錯誤。無法編譯主Java應用程序
這是我的界面...
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
我無法找出這些錯誤。任何幫助都會很棒。
你可以發佈你用於編譯的命令行嗎? – Teg
建議的意思 - 在嘗試修復其他錯誤之前總是修復第一個錯誤。在您的程序早期發生錯誤後會造成很多錯誤是很常見的。 – wattostudios
謝謝,我正在使用Eclipse IDE,通過刪除「()」來解決它是DisplayMessage – Ganderous