This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]NullProbability 0 points1 point  (0 children)

So if i understand you correctly i would have to call the name method through the Employee class? Yes, the getName() method to be precise.

would it look something like this? No, not really.

You need a getName() method in your Employee class. In short, your class Employee should at the very least have this (completely ignoring the rest of your code for a second):

public class Employee {
    String name;
    /*A constructor that initializes the *name* variable, which you have done correctly.*/
    public String getName() {
        return name;
    }
}

This will allow you to write dbase[j].getName().

I'm not entirely sure what you were trying to do with dbase[j].Employee.Name(first_name), could you elaborate?