Question: Create a letter format using eScape sequence.
Example--
Dear khare ,
Thanks Java couse is nice. Thanks
Ans:
package learning;
import java.util.Scanner;
public class learnNew {
public static void main(String[] args) {
// Scanner scan = new Scanner(System.in);
// String myString = "This space contains double and triple spaces";
// System.out.println(myString.indexOf(" "));
// System.out.println(myString.indexOf(" "));
//
//
//
//
// problem 5
String letter2 = "Dear khare ,\n\tThanks to buy our product. Thanks" ;
System.out.println(letter2);
}
}
Here I'm using back slash \ n and back slash \t
What is this ?🤔🤔
Let me clear this
\n = this is a escape sequence character to create a new line .
\t = this is a escape sequence character and its represent to TAB
Comments
Post a Comment