I want to switch-case the character \ but it is not working as I intend.
Because the character skips over the character after it, what would be the ' of the character literal. So I tried to do it as UTF. But it still does not work. Here is my code:
if(actVel == 0)
\ is a special escape character.
Here the list of escaped characters:
\nfor new line
\rfor carraige return
\ffor form feed
\'for the character
\"for the character
For a single
\ you need to use the special sequence
As an example:
System.out.println("Hello boys\\girls!"); // Prints: Hello boys\girls!
Fro your code you need to do the following:
case '\\': ... // Your code here
From the comment to the answer of aimee.
_/\_ should be written as
"_/\\_". The length of this String is 4 and is computed as follow:
_ 1 character / 1 character \\ 1 character (printed as \) _ 1 character