Home > Back-end >  Want to output element content but output element addresses
Want to output element content but output element addresses

Time:12-06

For detailed answers code to output element content

CodePudding user response:

You need in your entity class (Light) rewrite the toString method, can print object values,

CodePudding user response:

1, rewrite the toString ();
2, the iteration, conversion and output properties for the object

CodePudding user response:

The tostring

CodePudding user response:

1/f, reference source is a ghost reply:
you need in your entity class (Light) rewrite the toString method, will print it out, the object value is
need rewriting in the entity class toString () method

CodePudding user response:

System. Out. Print () method will default to invoke the object's tostring () method, because you're not rewritten, so directly using the superclass object of tostring () method, which is the default implementation returns a hash address, you can in your own classes to override the tostring () method, the ps (automatic call tostring and display can have different calling tostring, will join to the operation of the empty)

CodePudding user response:

All classes inherit Objec, and the Object's toString will output the class name, the name of the current Object and hashcode, general this kind of situation the demand are the output Object a property
  • Related