0

I'm creating a very basic converter program from the alphabet to a Leet character. I have the project finished, but will not compile correctly because I have a few "illegal escape characters"... My teacher needs what he gave us, for example the letter m would be //\ But that doesn't work out too well... is there a way that this will be able to work?

case 'm': case 'M': 
System.out.printf ("%s /\/\ \n", ch);  // m is supposed to look like /\/\
break;
case 'n': case 'N':
System.out.printf ("%s |\| \n", ch);   // n is supposed to look like |\|
break;

The letter "v" needs some help as well... to look like /

I need to have the \n after for the spacing, or is there another way?! Even when I took it out it still had the same error.

Just very new to this... Thank you!

Eric
  • 6,563
  • 5
  • 42
  • 66
Xela
  • 3
  • 2

1 Answers1

2

if you want to print backslash character, you need to escape it with another one like this:

System.out.printf ("%s /\\/\\ \n", ch); // m is supposed to look like /\/\

Sharon Ben Asher
  • 13,849
  • 5
  • 33
  • 47