Add java11-features module: runnable demos and captured output for the ankurm.com java11-features article
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
# trim vs strip on the same string, Java 8 has no strip(); the Java 8 compile of src/StringMethods.java:
|
||||
$ javac src/StringMethods.java (1.8.0_504)
|
||||
src/StringMethods.java:9: error: cannot find symbol
|
||||
System.out.println("strip() length : " + padded.strip().length());
|
||||
^
|
||||
symbol: method strip()
|
||||
location: variable padded of type String
|
||||
src/StringMethods.java:10: error: cannot find symbol
|
||||
System.out.println("isBlank(\" \") : " + " ".isBlank() + " isEmpty: " + " ".isEmpty());
|
||||
^
|
||||
symbol: method isBlank()
|
||||
location: class String
|
||||
src/StringMethods.java:11: error: cannot find symbol
|
||||
System.out.println("lines() : " + "a\nb\r\nc".lines().collect(Collectors.toList()));
|
||||
^
|
||||
symbol: method lines()
|
||||
location: class String
|
||||
src/StringMethods.java:12: error: cannot find symbol
|
||||
System.out.println("repeat(3) : " + "ab".repeat(3));
|
||||
^
|
||||
symbol: method repeat(int)
|
||||
location: class String
|
||||
src/StringMethods.java:13: error: cannot find symbol
|
||||
System.out.println("stripLeading : [" + " x ".stripLeading() + "] stripTrailing: [" + " x ".stripTrailing() + "]");
|
||||
^
|
||||
symbol: method stripLeading()
|
||||
location: class String
|
||||
src/StringMethods.java:13: error: cannot find symbol
|
||||
System.out.println("stripLeading : [" + " x ".stripLeading() + "] stripTrailing: [" + " x ".stripTrailing() + "]");
|
||||
^
|
||||
symbol: method stripTrailing()
|
||||
location: class String
|
||||
6 errors
|
||||
Reference in New Issue
Block a user