Java Escape Sequences in OS X Terminal

Is it just me or do the normal escape sequences for Java not work in OS X Terminal? I've been fiddling around with my code but no matter how I do it, the escape sequences always show up as errors when I compile my java file.


Is there some sort of OS X Terminal alternative to regular Java escape sequences buried somewhere on the internet? I swear I've been searching for hours now but I still can't find anything remotely close to the problem I'm having.


Any help is appreciated.


Thanks!

Posted on Sep 17, 2015 7:00 PM

Reply
4 replies

Sep 17, 2015 8:13 PM in response to Barney-15E

No, I'm just using Terminal to compile and run my java program.


For example, this simple java program has escape sequences for quotation marks inside the string.


public class simple

{

public static void main( String[] args )

{

System.out.println(“She said \“Hello World\””);

}

}


when I go to the terminal to compile I get 8 errors. The first error says:


simple.java:7: error: illegal character: '\u201c'

System.out.println(“She said \“Hello World\””);

^

simple.java:7: error: ';' expected

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Java Escape Sequences in OS X Terminal

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.