-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstrings.java
More file actions
39 lines (37 loc) · 995 Bytes
/
Copy pathstrings.java
File metadata and controls
39 lines (37 loc) · 995 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
30
31
32
33
34
35
36
37
38
39
//Write a program to perform the operations on String(inmutable)
class strings
{
public static void main(String[] args)
{
char a[]={'h','e','l','l','o'};
String x=new String(a);
System.out.println(a);
String y="ABCD";
String z="Abcd";
System.out.println(y.compareTo(z));
System.out.println(y.equals(z));
System.out.println(y.equalsIgnoreCase(z));
y=y.concat("xyz");
System.out.println(y.length());
y=y.trim();
System.out.println(y);
System.out.println(y.length());
System.out.println(y.toLowerCase());
System.out.println(x.toUpperCase());
System.out.println(y.substring(3));
System.out.println(y.substring(2,6));
System.out.println(y.endsWith("yz"));
System.out.println(x.replace('l','n'));
byte b[]=y.getBytes();
for (int i=0;i<b.length;i++)
{
System.out.println(b[i]);
}
char c[]=y.toCharArray();
for (int i=0;i<c.length ;i++ )
{
System.out.println(c[i]);
}
System.out.println(c);
}
}