java int to string – How to convert integer to string in Java

Java int to string conversion

In programming the most used data is of int (as for as numbers are concerned) and strings (if you are working with text) in any programming language. Situations come when you need to convert one data type into other to fulfil certain task. This tutorial explains how to convert a java int to string.

Using + operator to convert int to string java

The simplest way is to use a + operator to convert an int to string java. See example below how to use it..


Experience this online

The output will be:

java string to int example: 50

Convert int to string java by valueof method of String

You can also use valueof method of String object to convert an int to string in java. See example below how to use it:

Syntax of valueof method

String.valueof(int);

Following example shows how to use valueof method to convert java int to string.


Experience this online

The output will be:

string to int example: 50

Using toString method of Integer java – convert int to string

You may also use toString method of Integer to convert an int to string in java. See example below to leanr how to use it.

Syntax of using toString methof

Integer.toString(int);

Java toString method to convert java int to string example

Following example shows how to use java toString method to convert an int to string in java.


Experience this online

The output will be:

java int to string example: 50

Also see java strong to int | java double to int

Was this article helpful?

Related Articles

Leave A Comment?