-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDemo4.java
More file actions
29 lines (24 loc) · 790 Bytes
/
Copy pathDemo4.java
File metadata and controls
29 lines (24 loc) · 790 Bytes
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
public class Demo4 {
public static void main(String[] args) {
String a = "Hello";
System.out.println(a.length());
System.out.println(a.toUpperCase());
System.out.println(a.toLowerCase());
System.out.println(a);
a = a.toUpperCase();
System.out.println(a);
char r[] = a.toCharArray();
System.out.println(a.indexOf("L")); // First Occurance
System.out.println(a.lastIndexOf("L")); // Last Occurance
System.out.println(a.replace('L', 'K'));
String b = " Amit Srivastava ";
System.out.println("["+b+"]");
System.out.println("["+b.trim()+"]");
String address="A-21, Shakti Nagar, Delhi-7";
String array[] = address.split(",");
System.out.println("Array is "+array.length);
for(String z : array){
System.out.println(z);
}
}
}