Print Backslash and Quotes Together

This program prints backslashes and quotes together.

Problem Statement

Write a Java program that prints text with backslashes and quotes.

Source Code

1 public class BackslashQuotes {
2 public static void main(String[] args) {
3 System.out.println("Path: C:\\Eduinq\\\"Java\"");
4 }
5 }

Program Output

Path: C:\Eduinq\"Java"

Explanation

The \\ escape sequence prints a literal backslash and \" prints a double quote, allowing both special characters to appear together in the output, showing how to combine escape sequences.

Quick Links to Explore