-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchar and string basic
35 lines (33 loc) · 1.1 KB
/
char and string basic
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 charandstring {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
String n = sc.nextLine();
// char vib = n.charAt(2);
// System.out.println(vib);
// System.out.println(n.length());
// for(int i = 0 ; i<n.length(); i++) {
// char vibh = n.charAt(i);
// System.out.println(vibh);
// }
// System.out.println(n.substring(0,2));
// System.out.println(n.substring(1));
// for(int i = 0 ; i <n.length(); i++) {
// for(int j = i + 1; j<=n.length(); j++) {
// System.out.println(n.substring(i,j));
// }
// }
String s1 = "hello";
String s2 = "world";
String s3 = s1 + " " + s2;
// s1 += "0";
// s1 += "10";
// s1 += "vuib";
System.out.println(s1 + "heloo" + 10); //helloheloo10
String s = "ss int nitg vhib,inb";
String [] part = s.split(" ");
for(int i =0; i< part.length; i++) {
System.out.println(part[i]);
}
}
}