I need to set a variable false, If the string starts with ‘1’, but following code returns me a true value? i tried the word “apple”. Is there any problem with my code?
String msgName=request.getParameter("msgName");
boolean insideIf=false;
if(msgName.substring(0,1).equals("1"));
{
insideIf=true;
System.out.println("if status :"+msgName.substring(0,1).equals("1"));
} System.out.println("insideIf :"+insideIf);
It is 🙂
You’ve got a semicolon after your if