How To Convert Char To String and a String to char in Java | #java #char #String

preview_player
Показать описание
Program to convert char to String
We have following two ways for char to String conversion.
Method 1: Using toString() method
Method 2: Usng valueOf() method

class CharToStringDemo
{
public static void main(String args[])
{
// Method 1: Using toString() method
char ch = 'a';

// Method 2: Using valueOf() method
}
}
Output:

String is: a
String is: a
Рекомендации по теме