重写equals中,如果采用getClass检测类是否相等,后续是否仍需要强制转换类类型?

问题遇到的现象和发生背景
问题相关代码,请勿粘贴截图

public boolean equals(Object otherObject)
{
// a quick test to see if the objects are identical
if (this == otherObject) return true;

  // must return false if the explicit parameter is null
  if (otherObject == null) return false;

  // if the classes don't match, they can't be equal
  if (getClass() != otherObject.getClass()) return false;

  // 由于已经判断了getClass() != otherObject.getClass(),已经证明otherObject类与本类相同
  // 那么强制转换还有什么意义?
  var other = (Employee) otherObject;

  // test whether the fields have identical values
  return Objects.equals(name, other.name) 
     && salary == other.salary && Objects.equals(hireDay, other.hireDay);

}

运行结果及报错内容
我的解答思路和尝试过的方法
我想要达到的结果

因为你需要使用的是Employee类的特有成员,所以要向下转型。