Topic Java Halp
Delmin #276
Delmin
Edited by Delmin on 2/1/12 2:20 PM (PST)
I know this is slightly off topic, but it still has something to do with computers eh?

So I'm in a beginner computer science class, and I'm supposed to write a string that produces «/\/"\/\»


So I wrote this

class Homework1B {
public static void main(String[] args) {
System.out.println("«/\\/"\\/\\»");
}
}


But then it's giving me an "illegal character /92" on the middle ". Any ideas?

Also if anyone could tell me how I'm supposed to write Unicode, it'd be cool. I'm supposed to write the « and » via Unicode, which is apparently done by holding down Alt and then entering U+00AB and U+00BB, but it ain't workin'.
xDRxCptHavok #542
xDRxCptHavok
i dont know java i only took c#
Hibachi #279
Hibachi
needs proper escape character for the " in the middle of your println

Right now, the compiler thinks that " at the middle is the end of your text, and is looking for ); right after, but it does not, so it throws up an error
Elite #417
Elite
I'm in kind of the same boat as you. This semester I'm taking C++ and I still don't know what I'm doing yet.
Delmin #276
Delmin
Edited by Delmin on 2/1/12 5:03 PM (PST)
needs proper escape character for the " in the middle of your println

Right now, the compiler thinks that " at the middle is the end of your text, and is looking for ); right after, but it does not, so it throws up an error


Alright so I changed it up a bit and then it's working now, but then for some reason the stupid program won't accept a copypasted «» (it turns into ?s), so it still fails me. This sucks man.

Edit: Okay I got this program that decodes unicode, but then it still doesn't recognize it. Alright, time to skip this question!
Hibachi #279
Hibachi
As for the unicode, try this:

\u00AA for <<
\u00BB for >>
Delmin #276
Delmin
As for the unicode, try this:

\u00AA for <<
\u00BB for >>


Ah, that did the trick. Thanks man.
Hibachi #279
Hibachi
Np. ;)

Please report any Code of Conduct violations, including:

Threats of violence. We take these seriously and will alert the proper authorities.

Posts containing personal information about other players. This includes physical addresses, e-mail addresses, phone numbers, and inappropriate photos and/or videos.

Harassing or discriminatory language. This will not be tolerated.

Click here to view the Forums Code of Conduct.

Report Post # written by
Reason
Explain (256 characters max)

Reported!

[Close]