Skip to content
the poor coder

Hackerrank Java Int to String Solution

Poor Man
Published
Updated
Reading time
1 min read

You are given an integer , you have to convert it into a string.

Please complete the partially completed code in the editor. If your code successfully converts  into a string  the code will print "Good job". Otherwise it will print "Wrong answer".

can range between  to  inclusive.

Sample Input 0100

Sample Output 0.MathJax_SVG_LineBox {display: table!important} .MathJax_SVG_LineBox span {display: table-cell!important; width: 10000em!important; min-width: 0; max-width: none; padding: 0; border: 0; margin: 0} Good job

Solution in java8#

Approach 1.

Python
   String s = ""+n;

Approach 2.

Python
   String s = n+"";
   

Approach 3.

Python
   String s = String.valueOf(n);

Keep going

2020

Hackerrank Java Datatypes Solution

Java has 8 primitive data types; char, boolean, byte, short, int, long, float, and double. For this exercise, we'll work with the primitives used to hold integer values (byte, short, int, and long): A byte is an 8-bit…

ESC