// Derived class public class PermanentEmployee extends Employee private double baseSalary; private double bonus;
// Method 2: Implement Runnable (preferred) class MyRunnable implements Runnable public void run() /* task */ Infosys Java Training Material Pdf
public class InfosysTaxCalculator implements TaxCalculator @Override public double calculateTax(double income) return income * 0.10; // 10% tax private double bonus
List<Employee> list = new ArrayList<>(); list.sort(Comparator.comparing(Employee::getSalary).reversed()); 7. Multithreading & Concurrency Creating Threads // Method 1: Extend Thread class MyThread extends Thread public void run() /* task */ // 10% tax List<
// getters & setters
// for-each (preferred over index loops) for (String name : nameList) System.out.println(name);
public PermanentEmployee(String empId, String name, double baseSalary, double bonus) super(empId, name); this.baseSalary = baseSalary; this.bonus = bonus;