#Is this wrong?
1 messages ยท Page 1 of 1 (latest)
Here is an AI assisted attempt to answer your question ๐ค. Maybe it helps! In any case, a human is on the way ๐. To continue talking to the AI, you can use </chatgpt:1108714622413963314>.
Yes, the way you are trying to escape the double quotes in the desired output is incorrect. To achieve the desired output "She says: "that's John's "favorite food." ", you should escape the inner double quotes by preceding them with a backslash ().
Here is the correct way to do it:
System.out.println("She says: \"that's John's \"favorite food.\" ");
By adding a backslash before each inner double quote, you are telling Java to interpret them as part of the string literal and not as string delimiters. This will ensure that the output displays exactly as you intended.
why do you put random " in the sttring ?
nvm...I have to write my question from the start....my backslashes disappeared
ok, now
Closed the thread.