Question: [ public class F { private String first; protected String name; public F( ) { } public F( String f, String n ) { first

[ public class F

{

private String first;

protected String name;

public F( ) { } public F( String f, String n )

{ first = f; name = n; }

public String getFirst( )

{

return first;

}

public String getName ()

{

return name;

}

public String toString ( )

{

return ( "first: " + first + "\tname: " + name );

}

public boolean equals ( Object f )

{

if ( ! ( f instanceof F ) )

return false;

else

{

F objF = ( F ) f;

return( first.equals ( objF.first ) && name.equals ( objF.name ) );

}

}

}

public interface I

{ public static final String TYPE = "human";

public abstract int age ( );

}

22. Inside the G class. which inherits from the F class, declare a private instance variable for the middle initial and code a constructor with three parameters, calling the constructor of the F class and assigning the third parameter, a char, to the new instance variable. **

23. Inside the G class, which inherits from the F class, code the toStritrg method, which returns a printable representation of a G object reference.**

24. Inside the G class, which inherits from the F class, code theequals method, which compares two G objects and returns true if htey have identical instance variables; false otherwise. **

25. The K class inherits from the F class and the I interface; code the class header of the K class. **

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!