Prev Next

Java / Enum

Can an enum implement an interface?

Yes.

interface IJob {

	void jobRole();

}

public enum Job implements IJob {

	JOB1(50) {

		@Override
		void whoAmI() {
			System.out.println("I am a Software Tester.");

		}

		@Override
		public void jobRole() {
			System.out.println("My role is to Test the Software applications to assess quality.");

		}

	};

	int payPerHour;

	Job(int payPerHour) {
		this.payPerHour = payPerHour;
	}

	abstract void whoAmI();

}

More Related questions...

Show more question and Answers...


Comments & Discussions