From c7a4dd2da2bfccd4d4b4f140ca5e0241ad827f20 Mon Sep 17 00:00:00 2001 From: gauravkukade Date: Sun, 28 Feb 2021 11:07:06 +0530 Subject: [PATCH] Update int to string in java blogpost --- .../2021-02-27-convert-int-to-string.md | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/_posts/java-string/2021-02-27-convert-int-to-string.md b/_posts/java-string/2021-02-27-convert-int-to-string.md index b8c3515..e55834b 100644 --- a/_posts/java-string/2021-02-27-convert-int-to-string.md +++ b/_posts/java-string/2021-02-27-convert-int-to-string.md @@ -88,7 +88,26 @@ Output ```java numberString: 1234 ``` -If you found this article worth, support me by [giving a cup of Coffee ☕](https://www.paypal.me/GauravKukade) + +## Conclusion + +We can convert an int to String in Java using + +1. the String.valueOf() method + +```java +String numberString = String.valueOf(number); +``` + +2. the Integer.toString() method. + +```java +String numberString = Integer.toString(number); +``` +In both cases, `number` is an `int` value. + +If you found this article worth, support me by [giving a cup of Coffee ☕](https://www.paypal.me/GauravKukade) + ### Related Articles