繁体   English   中英

app.java:14: 错误:非法启动表达式如何解决?(我刚开始学习java...)

[英]app.java:14: error: illegal start of expression how to fix it?(i just started learning java…)

app.java:14: error: illegal start of expression
.
^
app.java:16: error: 'else' without 'if'
else {
^

2 errors

整个代码是:

class app {
    public static void main(String[] args) {
        int number = 10;

        if (number > 0) {
            System.out.println("The number is positive.");
        }
        else if(number < 0) {
            System.out.println("The number is not positive.");
        }
        else if (number > 0) {
            System.out.println("The number is positive.");
        }
        .
        .
        else {
             System.out.println("Congrats you just solved the math in here!");
        }
    }
}

在第 14 行和第 15 行删除 (.) 试试这个。

if(true){
        
}
else if(true){
        
}
else if(true){
        
}
else{
        
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM