.
Apple
"Mandarin orange"
melon
How should I fill in the mandarin oranges only when I want to emphasize them with "" (double quotation marks)? : thinking:
test.java
public class Main {
public static void main(String[] args) {
System.out.println("Apple");
System.out.println(""Mandarin orange"");
System.out.println("melon");
}
}
When I added "" to the mandarin oranges as above, I got a compile error: weary: Escape sequences are used in such cases: smile: If you modify it to the following code that uses escape sequences ...
Example.java
public class Main {
public static void main(String[] args) {
System.out.println("Apple");
System.out.println("¥"Mandarin orange ¥"");
System.out.println("melon");
}
}
console.
Apple
"Mandarin orange"
melon
It was displayed properly: laughing:
The reason why I got an error earlier PC-kun judges from "to" as a character string.
In other words, "" mandarin orange "" There are no characters from "to", right? ?? It says mandarin oranges, but what is this? ?? Also, there are no characters from "to", right? ?? ... I will send it back. That means: scream:
To avoid that, put a \ in front of ", this is not a string". "What is it for you to display as characters?" Therefore, I will write \ "to distinguish it, so please display it as a character. That means: smile:
Therefore, if you put \ in front of the symbol you want to display, it will be displayed as a character. Some of them are listed below: smile:
Notation | meaning |
---|---|
¥" | "(Double quotation) |
¥' | '(Single quotation mark) |
¥¥ | ¥ (Yen mark) |
Recommended Posts