// tired
if (staff instanceof Employee employee)
employee.paySalary();
else if (staff instanceof Freelancer freelancer)
freelancer.payBill();
// wired
switch (staff) {
case Employee emp -> emp.paySalary();
case Freelancer free -> free.payBill();
default -> { }
}