
- Java Tutorial
- Java - Home
- Java - Overview
- Java - Environment Setup
- Java - Basic Syntax
- Java - Variable Types
- Java - Basic Datatypes
- Java - Basic Operators
- Java Control Statements
- Java - Loop Control
- Java - Decision Making
- Java - If-else
- Java - Switch
- Java - For Loops
- Java - For-Each Loops
- Java - While Loops
- Java - do-while Loops
- Java - Break
- Java - Continue
- Object Oriented Programming
- Java - Object & Classes
- Java - Methods
- Java - Constructors
- Java - Access Modifiers
- Java - Inheritance
- Java - Polymorphism
- Java - Overriding
- Java - Abstraction
- Java - Encapsulation
- Java - Interfaces
- Java - Packages
- Java - Inner classes
- Java Data Types
- Java - Characters
- Java File Handling
- Java - Files and I/O
- Java Error & Exceptions
- Java - Exceptions
- Java Multithreading
- Java - Multithreading
- Java Synchronization
- Java - Synchronization
- Java - Inter-thread Communication
- Java - Thread Deadlock
- Java - Thread Control
- Java Networking
- Java - Networking
- Java - URL Processing
- Java - Generics
- Java Collections
- Java - Collections
- Java List Interface
- Java - List Interface
- Java Queue Interface
- Java - Queue Interface
- Java Map Interface
- Java - Map Interface
- Java - SortedMap Interface
- Java Set Interface
- Java - Set Interface
- Java - SortedSet Interface
- Java Data Structures
- Java - Data Structures
- Java - Enumeration
- Java Collections Algorithms
- Java - Collections
- Java - Iterators
- Java - Comparators
- Java Miscellenous
- Java - Regular Expressions
- Java - Serialization
- Java - Sending Email
- Java - Applet Basics
- Java - Documentation
- Java Useful Resources
- Java - Questions and Answers
- Java - Quick Guide
- Java - Useful Resources
- Java - Discussion
- Java - Examples
Java - String toCharArray() Method
Description
This method converts this string to a new character array.
Syntax
Here is the syntax of this method −
public char[] toCharArray()
Parameters
Here is the detail of parameters −
NA
Return Value
It returns a newly allocated character array, whose length is the length of this string and whose contents are initialized to contain the character sequence represented by this string.
Example
import java.io.*; public class Test { public static void main(String args[]) { String Str = new String("Welcome to Tutorialspoint.com"); System.out.print("Return Value :" ); System.out.println(Str.toCharArray() ); } }
This will produce the following result −
Output
Return Value :Welcome to Tutorialspoint.com
java_strings.htm
Advertisements