Friday, 4 July 2014

How do I compare strings in Java

Use equals () to compare

two string 



package com.vipul;

public class StringComporation {

      /**
      * How do I compare strings in Java
      * @param args
      */
      public static void main(String[] args) {
            String fooString1 = new String("foo");
            String fooString2 = new String("foo");
            // Evaluates to true
            if(fooString1.equals(fooString2));
            {
                  System.out.println(fooString1);
            }
           

      }

}
==========================================================================
Maven + eclipse related 
An internal error occurred during: "Importing Maven projects". Unsupported IClasspathEntry kind=4 fixed

==================================================================================

No comments:

Post a Comment