
- Java Tutorial
- Java - Home
- Java - Overview
- Java - Environment Setup
- Java - Basic Syntax
- Java - Object & Classes
- Java - Constructors
- Java - Basic Datatypes
- Java - Variable Types
- Java - Modifier Types
- Java - Basic Operators
- Java - Loop Control
- Java - Decision Making
- Java - Numbers
- Java - Characters
- Java - Strings
- Java - Arrays
- Java - Date & Time
- Java - Regular Expressions
- Java - Methods
- Java - Files and I/O
- Java - Exceptions
- Java - Inner classes
- Java Object Oriented
- Java - Inheritance
- Java - Overriding
- Java - Polymorphism
- Java - Abstraction
- Java - Encapsulation
- Java - Interfaces
- Java - Packages
- Java Advanced
- Java - Data Structures
- Java - Collections
- Java - Generics
- Java - Serialization
- Java - Networking
- Java - Sending Email
- Java - Multithreading
- Java - Applet Basics
- Java - Documentation
- Java Useful Resources
- Java - Questions and Answers
- Java - Quick Guide
- Java - Useful Resources
- Java - Discussion
- Java - Examples
String copyValueOf(data, offset, count)
Description
This returns a String that represents the character sequence in the array specified.
Syntax
Here is the syntax of this method −
public static String copyValueOf(char[] data, int offset, int count)
Parameters
Here is the detail of parameters −
data − the character array.
offset − initial offset of the subarray.
count − length of the subarray.
Return Value
This method returns a String that contains the characters of the character array.
Example
public class Test { public static void main(String args[]) { char[] Str1 = {'h', 'e', 'l', 'l', 'o', ' ', 'w', 'o', 'r', 'l', 'd'}; String Str2 = ""; Str2 = Str2.copyValueOf( Str1, 2, 6 ); System.out.println("Returned String: " + Str2); } }
This will produce the following result −
Output
Returned String: llo wo
java_strings.htm
Advertisements