I want to check if the first letter of user first input is similar to the first letter for second user input

320 Views Asked by At

The program will prompt user to enter his name then enter different names Then it will check if the first letter of these dofferent names is similar to the first letter of his name

I tried

Scanner input = new Scanner(System.in) 
String MyName;
MyName = input.nextLine();
String FreindName;
FreindName = input.nextLine();
int count

char let1 = FreindName.CharAt(0);

char let2 = MyName.CharAt(0);

if (let1 == let2){

        count++;} 

The problem is after processing the program the count is still 0

0

There are 0 best solutions below