Question: a public static method header using Java generics whose parameter type is an ArrayList whose data consists of Person(image attached) or any concrete subclass thereof.
a public static method header using Java generics whose parameter type is an ArrayList whose data consists of Person(image attached) or any concrete subclass thereof. Whatever type of data is in the list will also be the method's return type.

23456 1 class Student extends Person 2 { public Student( String n, int ag, String ad, String p, double g ) { super(n, ag, ad, p ); gpa = g; } 7 public String toString( ) 8 { return super.toString( ) + getGPA( ); } 9 10 public double getGPA( ) 11 { return gpa; } 12 13 private double gpa; 14 } 15 16 class Employee extends Person 17 { 18 public Employee ( String n, 19 20 String p, { super( n, ag, ad, p ); = int ag, String ad, double s ) salary s; } 21 22 public String toString( ) 23 24 25 26 27 2232 28 29 30 31 32 } { return super.toString() + $" + getSalary( ); } public double getSalary( ) { return salary; } public void raise ( double percentRaise ) { salary *= ( 1 + percentRaise ); } private double salary;
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
