Skip to content

Instantly share code, notes, and snippets.

@aniketmlk6
Created July 3, 2021 14:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aniketmlk6/ce996983b671f4db2859c3562b50d677 to your computer and use it in GitHub Desktop.
Save aniketmlk6/ce996983b671f4db2859c3562b50d677 to your computer and use it in GitHub Desktop.
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