Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - I would like to ask "String Retvalue = et.tostring ();" Use Java code. What does et stand for
I would like to ask "String Retvalue = et.tostring ();" Use Java code. What does et stand for
Et is an object of a class, which can be:

A class that overrides the toString method of the root class object.

In this way, the call to et.toString () is an rewritten version of the toString method.

For example:

Level a

{

Common string toString ()

{

Return to "Class A";

}

}

A et = new A();

The value of //s is the string class a.

string s = et . tostring();

Here's an example:

Second, there is no class that overrides the toString method of the root class object.

In this way, et.toString () is called the toString method inherited from the root class object, and the string returned by this inheritance method consists of the following:

The complete path name (including package name) of the class to which the object belongs, and the hexadecimal representation of +@+ 16 object hash code.

For example:

Level a

{}

rule

A et = new A();

string s = et . tostring();

same as

A et = new A();

String s=et.getClass()。 getName()+" @ "+integer . tohexstring(et . hashcode());

Here's an example: