I am trying to compare a user entered character(letter) with individual letters in a word; and generating an appropriate message when this letter matches any of these individual letters in the word. As I ask the user to enter the letter like:
String newLetter;
Scanner keyboard= new Scanner(System.in);
System.out.println("Enter your letter: ");
newLetter = keyboard.next();
It assumes that the entered letter is a string(I can not express is otherwise, for example with char) on the other hand, I express individual letters of a given word as:
char i=word.charAt(n-1);
where n equals the length of the string(word). But, when I tend to compare i with newLetter, to see if these letters are the same or not, I cannot find any solution; however, both of them return a letter but one of them was defined as 'string' and the other one as 'char'. Can you please assist me with that and if there is anything wrong here? Thanks a lot