Blue Zen wrote:Well, it doesn't display anything, which I guess it wouldn't,
Right. Because you're not telling it to. So we can dispense with that line of thinking.
but I don't know how to get the program to display
Yes, you do. I know this, because you're doing it elsewhere.
I thought I could call getHeading and then getString, but nothing happens when I do that.
Incorrect. Something happens. You seem to be back to assuming that every step that happens will automagically be printed out.
I tried putting this at the end, but I think I still don't understand the correct syntax and where the items are supposed to be calling to:
System.out.println(Employee.getHeading);
System.out.println(empl1.toString);
System.out.println(empl2.toString);
When you say "I tried X but it didn't work," you need to be specific about what "didn't work" means. In this case, it's easy to see what you did wrong, but in the future, remember to provide details.
getHeading and toString are methods, so you need parentheses when calling them, that is, getHeading() and toString().
Additionally, calling println(X.toString()) is the same as just println(X), since println() ends up calling toString() anyway. The only difference is that println checks for null first and prints the
string "null". If you just call toString() like you're doing, without checking for null, and it is null, you'll get a NullPointerException.