Thursday 31 March 2016

Java Tutorial : Java String [copyValueOf(char[] data,int offset,int count) method]


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

Click the below Image to Enlarge
Java Tutorial : Java String [copyValueOf(char[] data,int offset,int count) method] 
CopyValueOfDemo.java
/*
 * public static String copyValueOf(char[] data, 
 *                           int offset, int count) 
 * 
 * Equivalent to valueOf(char[], int, int).
 * 
 * Parameters: 
 * ---------- 
 * data - the character array. 
 * 
 * offset - initial offset of the subarray. 
 * 
 * count - length of the subarray.
 * 
 * Returns: 
 * ------- 
 * a String that contains the characters of the
 * specified subarray of the character array.
 * 
 * Throws: 
 * ------ 
 * IndexOutOfBoundsException - if offset is negative, or
 * count is negative, or offset+count is larger than
 * data.length.
 */

public class CopyValueOfDemo
{

    public static void main(String[] args)
    {
        char[] charArray =
        { 'H', 'i', ' ', 'W', 'e', 'l', 'c', 'o', 'm', 'e' };

        String str = String.copyValueOf(charArray, 6, 3);
        System.out.println(str);

    }

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

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

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