一、⭐⭐⭐何为内存泄漏🌙🌙🌙
内存泄漏,指的是该对象在Java应用程序中的使命已经完结,该做的事情都已经做完了,对Java应用程序来说,已经没有继续存在的价值和意义了,可以被GC回收了。可偏偏GC无法对这个对象做回收处理。因为,该对象被错误的禁锢在了某个不知名不易被察觉的地方。
随着时间的流逝,这种因各种原因导致的内存泄漏而存在的无效对象会越来愈多,占用的内存就越大,就有可能会导致Java应用程序申请不到足够的内存空间,引发内存溢出。
二、⭐⭐⭐Object中的hashCode和equals方法,注意注释🌙🌙🌙
/*
* Whenever it is invoked on the same object more than once during
* an execution of a Java application, the {@code hashCode} method
* must consistently return the same integer, provided no information
* used in {@code equals} comparisons on the object is modified.
* This integer need not remain consistent from one execution of an
* application