Menu

(Solved) : Created Worker Workers New Worker 5 Another Class Separate Worker Worker Class Used Public Q29869021 . . .

Created Worker[] workers = new Worker[5]; in another classseparate from Worker.

In Worker class I used public void setSalary(double sal) {salary = sal; } and public double getSalary() { return salary; }and my worker constructor is:

Worker(double sal){

salary = sal;

}

How do I access the variable “salary”:storing values from eacharray slot, from my worker class on my other class with the Work[]workers array? i.e. sharing variables from a class to another?

Expert Answer


Answer to Created Worker Workers New Worker 5 Another Class Separate Worker Worker Class Used Public Q29869021 . . .

OR