INSTAGRAM | / javac_programming
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';
String str = Character.toString(ch);
System.out.println("String is: "+str);
// Method 2: Using valueOf() method
String str2 = String.valueOf(ch);
System.out.println("String is: "+str2);
}
}
Output:
String is: a
String is: a
En esta página del sitio puede ver el video en línea How To Convert Char To String and a String to char in Java | de Duración hora minuto segunda en buena calidad , que subió el usuario Aman Tripathi 19 mayo 2021, comparta el enlace con amigos y conocidos, en youtube este video ya ha sido visto 19 veces y le gustó 4 a los espectadores. Disfruta viendo!