Let’s say you have a number x of integer type how we can convert it to a String?
Here are the options:
1 2 3 4 5 6 |
// actually call .toString for given object int number = "999"; String string1 = String.valueOf(number); String string2 = "" + number; // call parseInt internally String string3 = Integer.toString(number); |