+ 1
if (name.substring(0,1) == name1.charAt(0) )
name is a user input and name1 is a predefined String am comparing if the first letter is equals to user input then printing some text....But am getting error if (name.substring(0,1) == name1.charAt(0) ) on this...... regards... revuri.
2 Respostas
+ 9
name.substring will return a string while name1.charAt will return a char, you cannot use the "==" operator on different data types
+ 2
you are comparing a string and a char. Doesnt work that way.