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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started