This is a Java program that demonstrates how to convert a long value to a string using the Long.toString() method. In this program, a long variable a is initialized with the value of 1423461. Then, a null string variable str is declared.
The program then uses the System.out.println() method to print the value of the long variable a. Next, the Long.toString() method is called, passing in the long variable a as an argument. This method returns a string representation of the long value. The returned string is then assigned to the str variable.
Finally, the program uses the System.out.println() method to print the string representation of the long value that was stored in the str variable.
public class LongToString { public static void main(String args[]) { long a = 1423461; String str = null; System.out.println("Integer Values : " + a); //convert long to string str = Long.toString(a); System.out.println("Long to String : " + str); } }
Integer Values : 1423461 Long to String : 1423461
Learn All in Tamil © Designed & Developed By Tutor Joes | Privacy Policy | Terms & Conditions