How are you guys, I need your help in java
could someone know how to change from character to string

what I mean is that let's say I have a variable x with char type and it has a value a.
so how I can change that value (a) from the character to string to be like this "a" and use it as a value of y variable which is in String type.

char x='a';
String y;

how I get this result y="a";

Recommended Answers

All 2 Replies

String.valueOf(x);
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.