I want to check if the input is only 1 letter or more than 1, below is my code
public ResponseEntity<String> moReceiver(@RequestParam("data")String data)
String[]subKeyword=data.split(" ");
String subKwd=subKeyword[1];
if(subKwd =="")
{
System.out.println("One letter");
}
else
{
System.out.println("More than One letter");
}
tried to use
==""
but doesnt work.. :( ,and got this error --->Index 1 out of bounds for length 1