-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstring_06.java
More file actions
89 lines (65 loc) · 3.15 KB
/
Copy pathstring_06.java
File metadata and controls
89 lines (65 loc) · 3.15 KB
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
package Java_practice;
import java.util.Locale;
import java.util.Scanner;
public class string_06 {
public static void main(String[] args) {
String str=new String("Vijaywada");
System.out.println("Given String is " +str);
System.out.println("Substring 4 Is");
String substring= str.substring(0,4);
System.out.println(substring);
System.out.println("************|Ends Here|**********");
System.out.println("Replacing a with x");
String replace=str.replace("a","x");
System.out.println(replace);
System.out.println("************|Ends Here|**********");
System.out.println("Checking if string starting with v");
boolean Startwith=str.startsWith("V");
System.out.println(Startwith);
System.out.println("************|Ends Here|**********");
System.out.println("Checking if string End with a");
boolean Endwith=str.endsWith("a");
System.out.println(Endwith);
System.out.println("************|Ends Here|**********");
System.out.println("Checking character at index 2");
char char_index=str.charAt(2);
System.out.println(char_index);
System.out.println("************|Ends Here|**********");
System.out.println("Checking index of given character y");
int index=str.indexOf("a");
System.out.println(index);
System.out.println("************|Ends Here|**********");
System.out.println("Checking string is matching");
boolean equal=str.equals("Vijaywada");
System.out.println(equal);
System.out.println("************|Ends Here|**********");
System.out.println("Checking string is matching");
boolean equal_without_case=str.equalsIgnoreCase("vijaywada");
System.out.println(equal_without_case);
System.out.println("************|Ends Here|**********");
String Lowercase= str.toLowerCase();
System.out.println("String Into Lowercase is " +Lowercase);
String Uppercase= str.toUpperCase();
System.out.println("String Into Uppercase is " +Uppercase);
System.out.println("************|Ends Here|**********");
//int a=6;
// float b=7575.858f;
// System.out.printf("The value of a is %d and value of b is %f",a,b);
// Scanner sc=new Scanner(System.in);
// System.out.println("Enter String");
// entered_string =sc.next(); // Only print values till space occur
//
//String entered_string_full=sc.nextLine(); // Prints all the value
//System.out.println("Output for sc.nextline "+entered_string_full);
System.out.println("ESC Sequence character");
String Letter= "Im Learning Java From Basic";
String Letter1= "Im Learning\n Java From Basic"; // \n for next line
String Letter2= "Im Learning\t Java From Basic"; // \t for tab
String Letter3= "\"Im Learning Java From Basic\"";
System.out.println(Letter);
System.out.println(Letter1);
System.out.println(Letter2);
System.out.println(Letter3);
System.out.println("************|Ends Here|**********");
}
}