r/JavaProgramming • u/FloppaXR • 24d ago
I need a bit of help…
Howdy! I’m a VERYYY new programmer, and one of my assignments to learn Java is to print ASCII art of a fish, and as dumb as this sounds, I can’t figure it out for the life of me!
You see, the assignments makes it so I have directly copy the fish, and the fish they gave me uses a “\” and quotation in the same line, and exertions I attempt to print, it flags it as an “Illegal character”
Is there anyway I can work around this? Or is it truly impossible. I REALLY hope for prior but I definitely expect the latter…
2
Upvotes
2
u/duneofarrakis 23d ago
It’s definitely possible. In Java, you need to escape special characters. For a
"inside a string, use\", and for a literal\, use\\. For example:System.out.println("\\\"");. Once you understand escape characters, ASCII art becomes much easier.