Link to home
Start Free TrialLog in
Avatar of SunnyX
SunnyX

asked on

Core java. Create the class with method that do logic for all elements of collection.

Let there is pretty straightforward classes

public class Employees {
    String lastName;

    Employees(String lastName, int salary) {
        this.lastName = lastName;
        this.salary = salary; 

    }

    public String getLastName() {
        return lastName;
    }
}

public class EmployeesTest {

    public static void main(String[] args) { 
        new Employees("Smith", 60000);
        new Employees("Page", 75000);
        new Employees("Musk", 88000);
        new Employees("Dorsy",55000);
        new Employees("Gates",54000);
       
    }
}

Open in new window


I need to create some method that for example increase salary for all employees of the collection.
ASKER CERTIFIED SOLUTION
Avatar of gurpsbassi
gurpsbassi
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial