我有一个错误,我无法理解 [英] I have an error that I can't understand it
本文介绍了我有一个错误,我无法理解的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
private static void menu(){
(错误出现在私有静态void菜单中,我标有红色)
错误:非法开始表达
public static void main( String [] args){
// 这里的TODO代码应用程序逻辑
students.put((( long ) 101010 ), new HomeStudent( Pisty, Bolt, Oradea, 0 7568478685, mintias@Roehampton.ac.uk, new Date(), - 2000 ,Course.Computing, 101010 ));
students.put((( long ) 101011 ), new InternationalStudent( Andreea, Orescu, 新York, 07654734567, ariesu@Roehampton.ac.uk, new 日期(), - 5000 ,Course.Accounting, 101011 ));
students.put((( long ) 101012 ), new InternationalStudent( Raluca, Dumitras, 新Orlens, 07345286427, ralu78@Roehampton.ac.uk, new 日期(), - 5000 ,Course.Business, 101012 ));
students.put((( long ) 101013 ),新 HomeStudent( Filimon, Razvan, Cluj -Napoca, 07597153479, filian@Roehampton.ac.uk, new 日期(), - 2000 ,Course.Accounting, 101013 ));
menu();
私有 静态 void 菜单(){
System.out.println( ***********************跨度>);
System.out.println( * Bright Future *);
System.out.println( *************** ********跨度>);
System.out.println( 1.Enroll);
System.out.println( 2.Pay Fees);
System.out.println( 3.课程学生名单);
System.out.println( 4.Change Course);
System.out.println( 5.View Students Profile);
System.out.println( 从课程中删除学生);
System.out.println( \t **** Management Reporting ****< /跨度>);
System.out.println( \t退出);
System.out.print( 输入选项:);
byte option = input.nextByte(); input.nextLine();
我尝试过:
我尝试了在互联网上找到的所有来源,似乎我无法得到它
解决方案
查看错误消息,并且在它正在抱怨的函数之前的代码 - 通常编译器报告问题的行是在实际错误之后,因为那是在可检测到问题的时候。与书籍中只找不到页面的方式大致相同,因为在缺失页面之前开始的句子不会在下一页上结束!
您应该尝试添加一个'}'那里
menu();
} // 尝试添加此行
private static void menu(){
请参阅跟踪:学习Java语言(The Java™Tutorials) [ ^ ]。
private static void menu () {
(the error is here at the private static void menu I have it marked with red )
Error: illegal start of expression
public static void main(String[] args) {
// TODO code application logic here
students.put(((long)101010), new HomeStudent("Pisty","Bolt","Oradea","07568478685","mintias@Roehampton.ac.uk",new Date(),-2000,Course.Computing,101010));
students.put(((long)101011), new InternationalStudent("Andreea","Orescu","New York","07654734567","ariesu@Roehampton.ac.uk",new Date(),-5000,Course.Accounting,101011));
students.put(((long)101012), new InternationalStudent("Raluca","Dumitras","New Orlens","07345286427","ralu78@Roehampton.ac.uk",new Date(),-5000,Course.Business,101012));
students.put(((long)101013), new HomeStudent("Filimon","Razvan","Cluj-Napoca","07597153479","filian@Roehampton.ac.uk",new Date(),-2000,Course.Accounting,101013));
menu () ;
private static void menu () {
System.out.println("***********************");
System.out.println(" * Bright Future *");
System.out.println("***********************");
System.out.println("1.Enroll");
System.out.println("2.Pay Fees");
System.out.println("3.List of Students on Course");
System.out.println("4.Change Course");
System.out.println("5.View Students Profile");
System.out.println("Remove Student From A Course");
System.out.println("\t **** Management Reporting ****");
System.out.println("\t Exit");
System.out.print("Enter Option:");
byte option = input.nextByte(); input.nextLine();
What I have tried:
I tried all of the sources that I could find on the internet it seems that I cannot get it
解决方案
Look at the error message, and at the code immediately before the function it is complaining about - very often the line that the compiler reports a problem with is after the actual error because that's when the problem is detectable. Much the same way that you only find a page is missing from a book because a sentence that starts before the missing page doesn't end on the next one!
You should try to add a '}' there
menu () ; } // try to add this line private static void menu () {
See Trail: Learning the Java Language (The Java™ Tutorials)[^].
这篇关于我有一个错误,我无法理解的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文