Consider the classes Student and CollegeStudent, as described , and the following methods: public static void main(String args[]) { Student s = new CollegeStudent(...); CollegeStudent cs = new...


Consider the classes Student and CollegeStudent, as described , and the following methods:


public static void main(String args[])


{


Student s = new CollegeStudent(...);


CollegeStudent cs = new CollegeStudent(...);


process(s);


process(cs);


} // end main


public static void process(Student aStudent)


{


System.out.println(aStudent.getName();


...


} // end process


a. What are the static and dynamic types of s, cs, and aStudent when the code is executed?


b. If we change the data type of the parameter aStudent from Student to CollegeStudent, will the main method execute correctly? If so, explain why; if not, explain why not and correct the method.



May 18, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here