-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstr_prbsol.java
40 lines (28 loc) · 1007 Bytes
/
str_prbsol.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import java.util.Scanner;
public class str_prbsol {
public static void main(String[] args) {
Scanner sr = new Scanner(System.in);
// qns-01
System.out.println("Enter your string:");
String str = sr.nextLine();
// String name = "Ragul";
System.out.println(str.toLowerCase());
//qns-02
System.out.println("Enter your String:");
String text = sr.nextLine();
System.out.println(text.replace(" ","_"));
// qns-03
System.out.println("Enter your name:");
String name = sr.nextLine();
System.out.println("Dear,"+name+" thanks a lot");
// qns-04
System.out.println("Enter your string:");
String detect = sr.nextLine();
System.out.println(detect.indexOf(" "));
System.out.println(detect.indexOf(" "));
// if compiler gives -1 as ans then it means there is no double or triple space
// qns-05
String letter = "Dear Harry,\n\t This course id nice.\n\t\tThanks!";
System.out.println(letter);
}
}