FileDocCategorySizeDatePackage
ManagerInArray.javaAPI DocExample584Sat Nov 25 12:56:22 GMT 2000None

ManagerInArray

public class ManagerInArray extends Object
This is a toy program that shows creating a Manager object.

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)

		Employee aa;
		Employee staff[] = {
			new Employee("Jon Jonsson", 45678),
			aa=new Employee("Robin Smith", 12345),
			new Manager("Finance", aa)
		};
		for (int i=0; i<staff.length; i++) {
			System.out.println("Employee's name is " + staff[i].getName());
			if (staff[i] instanceof Manager) {
				Manager mgr = (Manager)staff[i];
				System.out.println("\tIS A MANAGER; department is " +
					mgr.getManagedDepartment());
			}
		}