Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
31 lines (21 loc) · 1.15 KB

File metadata and controls

31 lines (21 loc) · 1.15 KB
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
package chapter07;
// StringOperation1.java
public class StringOperation1 {
public static void main(String[] args) {
String myString1 = "Hello My 1234 World!";
myStringOperations(myString1);
}
private static String myStringOperations(String myString) {
System.out.println("The Original string is:"+ myString);
System.out.println("\n");
System.out.println("The Original string is located at:"+ System.identityHashCode(myString));
System.out.println("The substring starts at index 0 is:" + myString.substring(0));
System.out.println("Length of the substring starts at index 0 is:" + myString.substring(0).length());
System.out.println("The substring starts at index 9 is:" + myString.substring(9));
System.out.println("Length of the substring starts at index 9 is:" + myString.substring(9).length());
System.out.println("Does the substring starts at index starts with 1? :" + myString.substring(9).startsWith("1"));
System.out.println("Does the substring starts at index ends with d? " + myString.substring(9).endsWith("d"));
System.out.println("Does the substring starts at index ends with !? " + myString.substring(9).endsWith("!"));
return myString;
}
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.