In Java, what is the difference between “” (empty quotes) and ” ” (quotes with a single space) and how do I test the former in terms of a char?
In Java, what is the difference between (empty quotes) and (quotes with a single
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
""represents the empty string." "is not empty, it contains a single space character.You can’t test the former in terms of a
char, as there are no characters: test for it in terms of aString: it is theStringof length zero, andString.equals("")returnstruefor the empty string.Or in terms of
chararrays, the empty string corresponds to thechararray of length zero, e.g.: