public class HelloSubstrings {
    static private String string = "We hold these truths to be self-evident, " + "that all men are created equal, "
            + "that they are endowed by their Creator with certain unalienable Rights, "
            + "that among these are Life, Liberty and the pursuit of Happiness.";

    public static void main(String... args) {
        System.out.println("Hello Substrings!");

        System.out.printf("\n%s\n\n", string);

        // 1. Substrings

        String str01 = string.substring(string.length() - 10);
        String str02 = string.substring(0, 40);

        System.out.printf("string.substring(string.length() - 10); = <%s>\n", str01);
        System.out.printf("string.substring(0,  40); = <%s>\n", str02);

        System.out.println("--------------------");

        // 2. Subsequences

        CharSequence csq01 = string.subSequence(string.length() - 10, string.length());
        CharSequence csq02 = string.subSequence(0, 40);

        System.out.printf("string.subSequence(string.length() - 10, string.length()); = <%s>\n", csq01);
        System.out.printf("string.subSequence(0,  40); = <%s>\n", csq02);
    }
}

@@ -100,17 +100,18 @@
 evident,
- 
+%5Cn
 %22 + %22tha
@@ -138,17 +138,18 @@
 d equal,
- 
+%5Cn
 %22%0A      
@@ -228,17 +228,18 @@
  Rights,
- 
+%5Cn
 %22%0A      
@@ -457,16 +457,79 @@
 string);
+%0A        System.out.printf(%22length = %25s%5Cn%5Cn%22, string.length());
 %0A%0A      
@@ -588,36 +588,114 @@
 bstring(
-string.length() - 10
+0, 40);%0A        String str02 = string.substring(3, 7);%0A        String str03 = string.substring(199
 );%0A     
@@ -700,33 +700,33 @@
      String str0
-2
+4
  = string.substr
@@ -725,28 +725,43 @@
 g.substring(
-0, 4
+string.length() - 1
 0);%0A%0A       
@@ -797,36 +797,161 @@
 bstring(
-string.length() - 10
+0,  40); = %3C%25s%3E%5Cn%22, str01);%0A        System.out.printf(%22string.substring(3, 7); = %3C%25s%3E%5Cn%22, str02);%0A        System.out.printf(%22string.substring(199
 ); = %3C%25s
@@ -952,33 +952,33 @@
  = %3C%25s%3E%5Cn%22, str0
-1
+3
 );%0A        Syste
@@ -1000,37 +1000,50 @@
 tring.substring(
-0,  4
+string.length() -1
 0); = %3C%25s%3E%5Cn%22, s
@@ -1045,17 +1045,17 @@
 n%22, str0
-2
+4
 );%0A%0A    
@@ -1188,33 +1188,32 @@
 tring.length() -
- 
 10, string.lengt
@@ -1338,17 +1338,16 @@
 ngth() -
- 
 10, stri
@@ -1448,21 +1448,29 @@
 %5Cn%22, csq02);
+        
 %0A    %7D%0A%7D%0A

Update HelloSubstrings.java