015-004-007

Type-based Filtering with ArrayList

Hard

Problem Description

Type-based Filtering with ArrayList

Learning Objective: Understand how to filter elements in ArrayList by type using instanceof

Overview

Create a program that extracts and counts only specific child class elements from parent class type ArrayList.

Specifications

  • Define Employee class and its subclasses Manager, Developer
  • Add various employees to ArrayList
  • Count Developers using instanceof

Output Format

Total employees: 4
Developers: 2

Ready to Try Running Code?

Log in to access the code editor and execute your solutions for this problem.

Don't have an account?