Last active
May 29, 2021 07:42
-
-
Save swetharnaik/359df025b0bf5e028a3b48ec9e941c67 to your computer and use it in GitHub Desktop.
Java11 - String Methods
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class StringMethods { | |
public static void main(String[] args) { | |
String s = "\tJAVA11 is the latest LTS version\t"; | |
System.out.println(s+"!!!"); | |
System.out.println(s.strip()+"!!!"); | |
System.out.println(s.trim()+"!!!"); | |
String blankOrEmpty = ""; | |
System.out.println("isEmpty: " + blankOrEmpty.isEmpty() + | |
" isBlank: " + blankOrEmpty.isBlank()); | |
blankOrEmpty = "\t "; | |
System.out.println("isEmpty: " + blankOrEmpty.isEmpty() + | |
" isBlank: " + blankOrEmpty.isBlank()); | |
String pleaseRepeat = "*"; | |
System.out.println("Repeated 5 times: " + pleaseRepeat.repeat(5)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment