Java Object.toString()
Syntax
Object.toString() has the following syntax.
public String toString()
Example
In the following code shows how to use Object.toString() method.
import java.util.ArrayList;
//from ww w . j a va 2 s. com
public class Main {
public static void main(String[] args) {
ArrayList list = new ArrayList();
list.add(50);
System.out.println(list.toString());
}
}