在终端中编译Java会在字符串中产生非法字符错误 [英] Compiling Java in terminal gives illegal character errors within a string
本文介绍了在终端中编译Java会在字符串中产生非法字符错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是新手,只是尝试做最基本的,简单的'Hello World'
I am new and just trying to do the most basic of all, simple 'Hello World'
这是代码,你可以在任何地方找到:
Here is the code, The same you find anywhere:
class HelloWorld {
public static void main (String args[]) {
System.out.println("Hello World!");
}
}
当我在终端中运行时(我使用的是Mac) )我提出以下错误:
When I run in the terminal (I use a Mac) I am posed with the following errors:
HelloWorld.java:3: error: illegal character: '\u201c'
System.out.println("Hello World!");
^
HelloWorld.java:3: error: ';' expected
System.out.println("Hello World!");
^
HelloWorld.java:3: error: not a statement
System.out.println("Hello World!");
^
HelloWorld.java:3: error: ';' expected
System.out.println("Hello World!");
^
HelloWorld.java:3: error: illegal character: '\u201d'
System.out.println("Hello World!");
^
5 errors
这里发生了什么?所有错误都是字符串!
What is going on here? All the errors are the string!
推荐答案
是错误的字符用来表示字符串 - 你应该使用
。
"
is the wrong character to use to denote a string - you should use "
.
这篇关于在终端中编译Java会在字符串中产生非法字符错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文