What functionality does /\ have? (one backslash and one forward slash)

Wendela Lövgren :

I'm doing some code excercises before an exam in Java and I've stumbled upon a problem.

This is the output I want to get:

/\Oj, så många
/\leende och lyckliga
/\programmerare!

And the given code is:

public class Selektion_3_18 {
    public static void main(String[] args) {
        System.out.println("Oj, så många leende och lyckliga programmerare!");
    }
}

I've tried googling the combination of back and forward slashes without getting a result.

My question is therefore; What is the functionality of /\? Or how am I supposed to use escape sequences to get the output they're asking for?

MS90 :

Well, you could achieve something like:

System.out.println("/\\ Oj, så många\n/\\ leende och lyckliga\n/\\ programmerare!");

Forward-slash doesn't need escape as literal back-slash does,the back-slash is used to escape special characters, such as the one used in the above string \n. If you want to use a literal back-slash, a double back-slash must be used.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=158389&siteId=1