-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStrings.java
More file actions
35 lines (25 loc) · 1.01 KB
/
Strings.java
File metadata and controls
35 lines (25 loc) · 1.01 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
import java.util.Scanner;
public class Strings {
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
String s = "\tabc def " ;
// System.out.println(s.charAt(2)); //Indexing
// System.out.println(s.length()); //lenght of string
// System.out.println(s.substring(2,s.length())); //Substring Function
// System.out.println(s);
// System.out.println(s.trim());
// System.out.println(s.contains("abc"));
// String c = "How are you";
// System.out.println(c.substring(3).indexOf('a'));
// System.out.println(c.indexOf('o'));
// System.out.println(c.lastIndexOf('o'));
char h = sc.next().charAt(0);
if(Character.isUpperCase(h))
System.out.println(Character.toLowerCase(h));
else
System.out.println(Character.toUpperCase(h));
// int n = 97;//A=65.a=97.'0'=48
// char c = (char)n;
// System.out.println('a' + "b" +'c');
}
}