title: Java Program for validation using string for alphanumeric is not giving me desired output
body: <p>Validation code using Java <code>string</code> is not giving me the desired output. It Should accept input as string alphanumeric and give output as valid only if it is given alphanumeric as s1 string and an integer as s2. otherwise, it should give output as an invalid output</p>
  
  <p>Tried using if else loop for validation.</p>
  
  <pre><code>import java.util.*;
  //import org.apache.commons.lang.StringUtils;
  public class Validation {
  
      public static void main(String[] args) {
          Scanner sc=new Scanner(System.in);
          System.out.println("enter the input:");
          String s1=sc.nextLine();
          String s2=sc.nextLine();
          boolean isValid1=s1.matches("[A-Za-z0-9]{10}");
          boolean isValid2=s2.matches("[0-9]");
          boolean isUpperCase=Character.isUpperCase(s1.charAt(0));
          System.out.println(isUpperCase);
          if((isValid1=true)&amp;&amp;(isValid2=true)&amp;&amp;(isUpperCase=true)){
                  System.out.println("value of s1 is: "+s1);
              System.out.println("Value of S2 is: "+s2);
          }
          else if((s1.isEmpty())&amp;&amp;(s2.isEmpty())) {
              System.out.println("Invalid Input");
          }
          else {
              System.out.println("Invalid Input");
          }
      }    
  }
  </code></pre>
  
  <p>The output is expected as displaying values of s1 and s2 only if s1 is given is alphanumeric and s2 as an  <code>Integer</code>. otherwise, it should display output as invalid input.</p>