Given the following Integer representation of a number
1 | int num = 123; |
Using String Concatenation
1 2 | String strNum = ""+num; System.out.println(strNum); |
Using String.valueOf
1 2 | String strNum = String.valueOf(num); System.out.println(strNum); |
Using Integer.toString
1 2 | String strNum = Integer.toString(num); System.out.println(strNum); |
All examples produce the following output to the console
Console Output
123