Wednesday, 30 March 2016

Java Tutorial : Java String [contentEquals(CharSequence cs) method]


Click here to watch in Youtube :
https://www.youtube.com/watch?v=NMG2oFYXbGc&list=UUhwKlOVR041tngjerWxVccw

Click the below Image to Enlarge
Java Tutorial : Java String [contentEquals(CharSequence cs) method] 
ContentEqualsDemo.java
/*
 * public boolean contentEquals(CharSequence cs)
 * 
 * Parameters: 
 * ---------- 
 * cs - The sequence to compare this String against
 * 
 * Returns: 
 * ------- 
 * true if this String represents the same sequence of
 * char values as the specified sequence, false
 * otherwise
 */

public class ContentEqualsDemo
{

    public static void main(String[] args)
    {
        String str1 = "Welcome Peter";
        String str2 = "Hi";
        String str3 = "Welcome Peter";

        boolean result = str1.contentEquals(str2);
        System.out.println("\"Welcome Peter\".contentEquals(\"Hi\") = " + result);
        result = str1.contentEquals(str3);
        System.out.println("\"Welcome Peter\".contentEquals(\"Welcome Peter\") = " + result);

    }

}
Output
"Welcome Peter".contentEquals("Hi") = false
"Welcome Peter".contentEquals("Welcome Peter") = true
Click the below link to download the code:
https://sites.google.com/site/javaee4321/java/StringDemo_contentEquals_App.zip?attredirects=0&d=1

Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/StringDemo_contentEquals_App

Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/89dfdef018d2970576505c9f498b5e4f28628c35/BasicJava/StringDemo_contentEquals_App/?at=master

See also:
  • All JavaEE Viedos Playlist
  • All JavaEE Viedos
  • All JAVA EE Links
  • Servlets Tutorial
  • All Design Patterns Links
  • JDBC Tutorial
  • Java Collection Framework Tutorial
  • JAVA Tutorial
  • No comments:

    Post a Comment

    Google+ Followers

    Google+ Badge