im stuck on a question from the book, java in 2 semesters chapter 7.
2a) write a program that asks the user to input a string, followed by a single character, and then tests whether the string starts with that character.
public class StringTest {
public static void main(String[] args) {
String s;
char c;
//input string
System.out.println("please enter a string: ");
s = EasyScanner.nextString();
//input char
System.out.println("please enter a character: ");
c = EasyScanner.nextChar();
//compare string and char
if(s.charAt(0) == c){
System.out.println("string starts with the character entered");
}
else{
System.out.println("string does not start with character entered");
}
}
}
im using a class called EasyScanner which helps in not calling the Scanner. Ok i think this is right for part a but im stuck on part b.
b) make your program work so that the case of the character is irrelevant.
*need help on this part*
Thanks in advance :)