samedi 18 avril 2015

Compiling Java in terminal gives illegal character errors within a string

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!”);
}
}


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!


Aucun commentaire:

Enregistrer un commentaire