- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Java String toCharArray() method example.
The toCharArray() method of a String class converts this string to a character array.
Example
import java.lang.*; public class StringDemo { public static void main(String[] args) { // converts String value to character array type value String str = " Java was developed by James Gosling"; char retval[] = str.toCharArray(); // displays the converted value System.out.println("Converted value to character array = "); System.out.println(retval); } }
Output
Converted value to character array = Java was developed by James Gosling
Advertisements