Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

java.lang.Object.toString()

Visual Studio 2005

Displays a human-readable representation of an Object.


public String toString()

A human-readable representation of an Object.

// object_tostring.jsl

public class MyObject extends Object
{
    public static void main(String[] args)
    {
        // Create a new instance of MyObject.
        MyObject obj = new MyObject();

        // Print out the string representation for obj.
        System.out.println("The string representation for obj is " +
            obj.toString());
    }
}

/*
Sample Output:
The string representation for obj is MyObject@33c0d9d
*/

Community Additions

ADD
Show:
© 2015 Microsoft