-
-
Save aniketmlk6/ce996983b671f4db2859c3562b50d677 to your computer and use it in GitHub Desktop.
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 static void main(String[] args) { | |
String term = "Java is awesome"; | |
char search_term = 'a'; | |
int counter = (int) term.chars().filter(ch -> ch==search_term).count(); | |
System.out.println("Character '" + search_term + "' occured " + counter + " times"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment