Question: In Java public class Person { protected String mFirstName; protected String mLastName; public Person(String first, String last) { mFirstName = first; mLastName = last; }
In Java
public class Person { protected String mFirstName; protected String mLastName; public Person(String first, String last) { mFirstName = first; mLastName = last; } public String getName() { return mFirstName + " " + mLastName; } } Write the code for a class named Student that inherits from Person and overrides the getName method to only return the first name of the person.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
