title: Can anyone help me to get extra character by comparing 2 inputed strings by using java
body: <p>.For example if i enter two strings ,say input1="sum" and input 2="su". I should get an output saying 'm' is the extra character present in a string.</p>
  
  <pre><code>public class odd {
  public static void main(String[] args)
  {
    boolean b = false;
    ArrayList&lt;String&gt; list= new ArrayList&lt;String&gt;();
    ArrayList&lt;String&gt; list1= new ArrayList&lt;String&gt;();
    String n1="sum";
    String n2="su";
    for(int i=1;i&lt;n1.length();i++){
      for(int j=1;j&lt;n2.length();j++){
          if(n1.charAt(i)==n2.charAt(j)){
               b=true;
              break;
          } 
          else{
              System.out.println("Extra character is "+n1.charAt(i));
          }
    }
  }
  
  }
  }
  </code></pre>