What code should be inserted to get a correct string representation of the variable l?

public class Test { 
    static public  void main(String args[]) {
        long l = 0;
        String s = new String();
        // insert code here
    }
}
Explanation
Primitive types do not have methods, so l.toString() will not compile.
Long.parse() accepts String object containing number as a parameter and returns Long object, so this is not a way to create string.
Long.toString(l) converts primitive long value to the string representation.
Operator plus + when accepts a string as and argument, converts second argument to String and makes a concatenation of strings, so ("" + l) will also create a string representation of long value.

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback