Im trying to a really simply condition statement. I need to check if my string first character is equal to 0.
I have a string that is equal to 0123, and I want to see if the first character is equal to 0.
String timetest = "0123";
if (timetest.substring(0, 1) == "0") {
System.out.println("first character is equal to 0");
} else {
System.out.println(time.toString().substring(0,2));
}
I dont get why it isn't printing "first character is equal to 0"?
Sorry for the simple question. I don't see why this isn't working.