-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathStringpp.java
43 lines (23 loc) · 1011 Bytes
/
Stringpp.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
41
42
43
import java.util.Scanner;
public class Stringpp
{
public static void main(String args[])
{
String first=" ",second=" ";
Scanner s=new Scanner(System.in);
System.out.println("String operation");
System.out.println();
System.out.println("Enter the first string");
first=s.nextLine();
System.out.println("Enter the second string");
second=s.nextLine();
System.out.println("The string are:"+first+" "+second);
System.out.println("THe length of the first string is:"+first.length());
System.out.println("The length of the Second string is:"+second.length());
System.out.println("The concatenation of the first and second string is :"+first.concat(" "+second));
System.out.println("The character of "+first+"is :"+first.charAt(0));
System.out.println("The uppercase of"+first+"is:"+first.toUpperCase());
System.out.println("The Substrinf of the "+first+" Starting from index 3 ans ending at 6 is:"+first.substring(3,7));
System.out.println("Replacing 'a' with 'o' in"+first.replace('a','o'));
}
}