In this section, you will learn to convert an object to a string.
Convert Object To String
In this section, you will learn to convert an object to a string. Object is a class of java.lang package.
Code Description:
This program helps you in converting an object type data into a string type data. The toString() method returns a string representation of the object. So, we get the an object type data is 10 and this program converts into a string type data as a '10'.
Here is the code of this program:
import java.io.*;
|
Output of this program given below.
C:\corejava>java ObjectToString String value is:=10 C:\corejava> _ |