diff --git a/frequency.java b/frequency.java new file mode 100644 index 0000000..a4281b5 --- /dev/null +++ b/frequency.java @@ -0,0 +1,16 @@ +public class Frequency { + + public static void main(String[] args) { + String str = "This website is awesome."; + char ch = 'e'; + int frequency = 0; + + for(int i = 0; i < str.length(); i++) { + if(ch == str.charAt(i)) { + ++frequency; + } + } + + System.out.println("Frequency of " + ch + " = " + frequency); + } +}