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
An answer will be send to you shortly. . . . .