title: Can multiple if statements be associated with a single else clause without using else-if?
body: <p>I have a validation method in which I have to check conditions one by one and then throw error messages accordingly. </p>
  
  <p>To achieve this, I am using multiple if statements, and if all the conditions are false, I should execute a task. </p>
  
  <p>Here's my code:</p>
  
  <pre><code>if(s1.equals("") || s2.equals("") || s3.equals("") || s4.equals("") || s5.equals("") || s6.equals(""))      
      Toast.makeText(getApplicationContext(),"Enter all Details first", Toast.LENGTH_SHORT).show();       
  if(!s5.matches("[A-Za-z0-9]+"))     
      e5.setError("Username cannot contain special characters");      
  if(s5.length()&lt;6)
      e5.setError("Username must be a minimum of 6 characters.");
  if(!(s3.contains("@")&amp;&amp; s3.contains(".")))
      e3.setError("Enter a valid Email Id");      
  if(!s6.equals(s7))
      e7.setError("Passwords dont match");
  if(s2.length()!=10)     
      e2.setError("Please enter a valid 10 digit number");        
  else
  {
      Validate v2=new Validate();
      v2.store_values(s1,s2,s3,s4,s5,s6,s8);
      v2.execute();
  }   
  </code></pre>
  
  <p>The problem is that the else statement is associated only with the last if statement, and the previous 5 if statements work independently. </p>
  
  <p>Please note that I cannot use else-ifs, since all the fields should be validated - for example even if <code>s3</code> is invalid, <code>s6</code> must still be validated. Therefore, all the if statements must be evaluated, regardless of how many are evaluated to true. </p>
  
  <p>How can I solve this problem?</p>