- 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 Program to Convert Character to String
The toString() method of the Character class converts the character to string. You can use this method to convert the given character to String.
Example
import java.util.Scanner; public class CharToString { public static void main(String args[]){ System.out.println("Enter a character ::"); Scanner sc = new Scanner(System.in); char ch = sc.next().charAt(0); String str = Character.toString(ch); System.out.println(str); } }
Output
Enter a character :: h h
Advertisements