Andrea Ideas Back to catalog
How to convert String to Double in Java and double to String with Example
Aug 28, 2026 Andrea

Mastering Java: Effortless Conversion - Char to String

In the Java programming language, converting a `char` to a `String` is a common operation, especially when dealing with character data. While a `char` can hold ...

In the Java programming language, converting a `char` to a `String` is a common operation, especially when dealing with character data. While a `char` can hold a single character, a `String` is a sequence of characters. Here are several methods to convert from `char` to `String` in Java.

How to convert String to Double in Java and double to String with Example

Before diving into the methods, it's essential to understand that in Java, a single `char` is actually a 16-bit Unicode character. When we convert a `char` to a `String`, we're essentially creating a sequence with a single character in it.

How to get first and last character of String in Java - Example

Using the String Constructor

The most straightforward way to convert a `char` to a `String` is by using the `String` constructor that accepts a `char`.

Java Strings Cheat Sheet | Complete String Methods Guide for Beginners

```java char c = 'A'; String str = new String(c); System.out.println(str); // Output: A ```

Character Set

Java string methods

If you have a set of characters and you want to convert them to a `String`, you can use the `String` constructor that accepts a `char` array.

```java char[] chars = {'H', 'e', 'l', 'l', 'o'}; String str = new String(chars); System.out.println(str); // Output: Hello ```

Character Sequence

Java Strings Made Easy | String Methods & StringBuilder Explained (Java Series #7)

If you have a sequence of characters stored as a `StringBuilder` or any other sequence, you can easily convert it to a `String` by calling the `toString()` method.

```java StringBuilder sb = new StringBuilder("World"); String str = sb.toString(); System.out.println(str); // Output: World ```

Using String.valueOf()

Java String Methods

The `String` class provides a `valueOf()` method that can convert almost any type to a `String`, including `char`.

```java char c = 'D'; String str = String.valueOf(c); System.out.println(str); // Output: D ```

[Solved] How to reverse a String in place in Java? Example
Strings in Java 💻✨ | Java Programming Notes
Java Lang String Cannot Be Converted to JSONObject: The Hilarious Guide to Fixing JSON Drama
Java script string method
String Conversion in C#
Java Strings Explained | String Basics, Methods & Immutability | Day 19
Java String Methods
the programming poster shows how to use strings

Array Conversion

You can also use `String.valueOf()` to convert a `char` array to a `String`.

```java char[] chars = {'J', 'a', 'v', 'a'}; String str = String.valueOf(chars); System.out.println(str); // Output: Java ```

Performance Considerations

While these methods all achieve the same outcome, there are subtle differences in performance. The constructor method creates a new `String` object on the heap, whereas `String.valueOf()` can reuse existing `String` objects in the string pool.

In most situations, the difference is negligible. However, if you're working in a performance-sensitive area like a real-time application, it might be worth considering the `String.valueOf()` method. Always remember, 'Premature optimization is the root of all evil,' said Donald Knuth, so profile and optimize if necessary.

In conclusion, converting a `char` to a `String` in Java is a common operation and can be achieved in multiple ways. Understanding these methods will help you make the best choice based on your specific context. Happy coding!

More shots

How to convert String to Double in Java and double to String with Example
How to convert String to Double in Java and double to String with Example
How to get first and last character of String in Java - Example
How to get first and last character of String in Java - Example
Java Strings Cheat Sheet  | Complete String Methods Guide for Beginners
Java Strings Cheat Sheet | Complete String Methods Guide for Beginners
Java string methods
Java string methods
Java Strings Made Easy | String Methods & StringBuilder Explained (Java Series #7)
Java Strings Made Easy | String Methods & StringBuilder Explained (Java Series #7)
Java String Methods
Java String Methods
[Solved] How to reverse a String in place in Java? Example
[Solved] How to reverse a String in place in Java? Example
Strings in Java 💻✨ | Java Programming Notes
Strings in Java 💻✨ | Java Programming Notes

Related topics