-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstring
More file actions
21 lines (16 loc) · 720 Bytes
/
string
File metadata and controls
21 lines (16 loc) · 720 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
public class App {
public static void main(String[] args) throws Exception {
String s = "Benim adım Hüsna POYRAZ";
s = s.toUpperCase();
System.out.println(s);
System.out.println("11. character is : " + s.charAt(11));
int firstSpace = s.indexOf(" ");
System.out.println("First Space' index no: " + firstSpace);
String firstWord = s.substring(0, firstSpace);
System.out.println("First Word variable: " + firstWord);
int lastSpace = s.lastIndexOf(" ");
System.out.println("Last Space' index no: " + lastSpace);
String lastWord = s.substring(lastSpace);
System.out.println("Last Word variable: " + lastWord);
}
}