任务执行失败:';编译ejava';安卓工作室
我是java新手,以前我成功地打印了hello world,但事情发生了,我不得不重置我的计算机。现在我又下载了androidstudio和java,突然间同样的代码无法编译任务执行失败:';编译ejava';安卓工作室,java,android-studio,Java,Android Studio,我是java新手,以前我成功地打印了hello world,但事情发生了,我不得不重置我的计算机。现在我又下载了androidstudio和java,突然间同样的代码无法编译 package com.example; public class MyClass { public static void main(String[] args){ System.out.println{"HELLO WORLD"); } } 下面是来自消息面板的消息 Informat
package com.example;
public class MyClass {
public static void main(String[] args){
System.out.println{"HELLO WORLD");
}
}
下面是来自消息面板的消息
Information:Gradle: Executing tasks: [:lib01:assemble]
Information:11/9/2017 8:02 PM - Compilation completed with 6 errors and 1
warning in 29s 437ms
Error:Gradle: Execution failed for task ':lib01:compileJava'.
> Compilation failed; see the compiler error output for details.
C:\Users\chong\Desktop\Java\Android_Studio\Week1\lib01\src\main\java\>com\example\MyClass.java
Error:(4, 18) Gradle: error: not a statement
Error:(4, 26) Gradle: error: ';' expected
Error:(4, 27) Gradle: error: not a statement
Error:(4, 40) Gradle: error: ';' expected
Error:(6, 1) Gradle: error: reached end of file while parsing
我不理解错误,因为它要求我插入;在代码的中间。请帮忙!谢谢大家! 您发布的代码看起来是为控制台应用程序编写的。我相信有人会纠正我的错误,但我不认为android studio有能力用于创建控制台应用程序 如果你刚刚起步,跳入android应用程序开发的最深处,至少可以说是痛苦的
作为替代方案,我建议获得最新版本的!创建一个新的控制台应用程序,然后再次尝试您发布的代码。打印后,您将使用括号而不是括号 你已经打印了{“你好,世界”
当它应该是println(“Hello World”);。LOL谢谢!!!!多么愚蠢的错误。我修复了语法,现在它可以编译了。哈哈哈。我应该给自己买一只橡皮鸭