//------------// Introduction to Programming Using Java: An Object-Oriented Approach//	Arnow/Weiss//------------// the getHighestPaid recursive method// Chapter 11, Section 11.3, Page 467-468// MODIFICATIONS://    power is made static here so we can test it without creating an objectimport java.io.*;import java.util.*;public class Demo_highPay {	////////////////////////////////////////////////////////////////////	static Employee  getHighestPaid(Enumeration  e) {		if  (!e.hasMoreElements())			return null;		Employee   emp,  highestOfThoseLeft;		emp  =  (Employee)  e.nextElement();		highestOfThoseLeft  =  getHighestPaid(e);		if  (highestOfThoseLeft==null				|| highestOfThoseLeft.getPay() < emp.getPay())			return  emp;		else			return  highestOfThoseLeft;	}	////////////////////////////////////////////////////////////////////	public static void main(String[] a) throws Exception {		Vector v = new Vector();		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));		Employee   emp;		emp = Employee.readIn(br);		while (emp!=null) {			v.addElement(emp);			emp = Employee.readIn(br);		}		emp = getHighestPaid(v.elements());		System.out.println("Highest paid employee ="+emp.getName()					+" with a rate of "+emp.getPay());	}}// Here is some sample input for this program:// Wallabee// 15// Fox// 18// Hawkins// 8// Gates// 15000// Buffett// 100// Cameron// 1000// The following is minimal version of an Employee class// suitable for demonstrating the above loop. Normally// it would be in a separate file, but is included in this// file for the sake of convenience.class Employee {	Employee(String name, int pay) {		this.name = name;		this.pay = pay;	}	static Employee readIn(BufferedReader br) throws Exception {		String n = br.readLine();		if (n==null)			return null;		String p = br.readLine();		if (p==null)			return null;		return new Employee(n,Integer.parseInt(p));	}	String getName() { return name;}	int getPay() { return pay;}	int calcPay(int hours) { return hours*pay; }	private	String	name;	private	int	pay;}