I want to print backslash t in Java. But whenever I try, it actualy takes it as \t operator. Double backslash didn't work. How can I do that.
Java code for the escape sequence \t: // \t -> It gives a tab between two words.
you can give tab space in java easily. "\t" is the space sequence in java programming.
Four spaces should be used as the unit of indentation. The exact construction of the indentation (spaces vs. tabs) is unspecified. Tabs must be set exactly every 8 spaces (not 4).
Escape the backslash by adding another, for example
System.out.println("This is a tab \t and this is not \\t");
If this doesn't work, there might be something else wrong in your code - please post it if this doesn't help you.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With