Kod:
import java.util.Scanner;
public class KelimeTekrar {
public static **** main(String[] args) {
Scanner input = new Scanner(System.in);
String cumle,harf;
int harfSayisi = 0;
System.out.println("Bir cümle giriniz: ");
cumle = input.nextLine();
System.out.println("Bir harf giriniz: ");
harf = input.next();
for(int i = 0; i < cumle.length() - 1;i++)
{
if(cumle.substring(i,i+1).equals(harf))
harfSayisi++;
}
System.out.println(harf + " harfi " + harfSayisi + " defa tekrar etmiştir.");
}
}