forked from BarkaBoss/Java-Full-Stack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStringDemo.java
More file actions
30 lines (22 loc) · 725 Bytes
/
Copy pathStringDemo.java
File metadata and controls
30 lines (22 loc) · 725 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
package string;
import java.util.Scanner;
public class StringDemo {
public static void main(String[] args) {
StringDemo demo = new StringDemo();
Scanner input = new Scanner(System.in);
String str = input.nextLine();
demo.reverseString(str);
String repStr = str.replace("c", "v");
System.out.println(repStr);
}
String reverseString(String string){
String str = string;
System.out.println(str.codePointCount(1, 4));
StringBuilder rev = new StringBuilder();
for (int i = str.length() - 1 ; i >= 0 ; i--) {
rev.append(str.charAt(i));
}
System.out.println(rev);
return rev.toString();
}
}