Thursday 10 March 2016

Java Tutorial : Java String (subSequence method)


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

Click the below Image to Enlarge
Java Tutorial : Java String (subSequence method) 
Java Tutorial : Java String (subSequence method) 
Java Tutorial : Java String (subSequence method) 
SubSequenceDemo.java
/*
 * public CharSequence subSequence(int beginIndex,
 *                                     int endIndex)
 * 
 * Parameters: 
 * ----------  
 * beginIndex - the begin index,
 * inclusive. endIndex - the end index, exclusive.
 * 
 * Returns: 
 * -------
 * Returns a character sequence that is a
 * subsequence of this sequence. 
 * 
 * An invocation of this method of the form
 * 
 * str.subSequence(begin, end) 
 * 
 * behaves in exactly the same way as the 
 * invocation
 * 
 * str.substring(begin, end)
 */

public class SubSequenceDemo
{

    public static void main(String[] args)
    {
        String str = "Welcome";
        CharSequence charSequence = str.subSequence(3, 6);
        String strValue = (String) charSequence;
        System.out.println("strValue = " + strValue);

    }
}
Output
strValue = com
Refer: 
https://docs.oracle.com/javase/8/docs/api/index.html?java/lang/CharSequence.html

Click the below link to download the code:
https://sites.google.com/site/javaee4321/java/StringDemo_subSequence_App.zip?attredirects=0&d=1

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

Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/a73203f981da1e65b72e10bb91ed595b4f0c377b/BasicJava/StringDemo_subSequence_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