Object class and Objects class summary

First, the Object class

1. Introduction to the Object class

The object class is the parent class of all classes, all classes will directly or indirectly inherit from this class

2.toString () method

  • Role: print the information of the object
  • Print before rewriting: package name class name @address value
  • Print after rewriting: attribute value in object

3.equals () method

  • Purpose: Compare two objects
  • Before rewriting: compare the addresses of two objects
  • After rewriting: compare the attribute values ​​of two objects

Second, the Objects class

Compare whether two objects are the same, but add robustness judgment

Published 395 original articles · won 130 · 200,000 views +

Guess you like

Origin blog.csdn.net/qq_40507857/article/details/103712741