Knowee
Questions
Features
Study Tools

extend implement extends implements super loan Loan Assume two classes with the name "Loan" and "HomeLoan".  It is a known fact that "HomeLoan" IS A TYPE OF "Loan".  Complete the code provided to establish the relationship between Loan and HomeLoan class.public class Loan{     //some code}public class HomeLoan   {     //some code}

Question

extend implement extends implements super loan Loan Assume two classes with the name "Loan" and "HomeLoan".  It is a known fact that "HomeLoan" IS A TYPE OF "Loan".  Complete the code provided to establish the relationship between Loan and HomeLoan class.public class Loan{     //some code}public class HomeLoan   {     //some code}

🧐 Not the exact question you are looking for?Go ask a question

Solution

To establish the relationship between Loan and HomeLoan class, you need to use the keyword "extends". This keyword in Java is used for inheritance between classes, where one class acquires the properties of another. In this case, HomeLoan is a type of Loan, so HomeLoan should extend Loan. Here is how you can do it:

public class Loan{ 
    //some code
}

public class HomeLoan extends Loan { 
    //some code
}

In this code, HomeLoan is the subclass (or derived class, or child class) and Loan is the superclass (or base class, or parent class). The HomeLoan class inherits all the fields and methods of the Loan class.

This problem has been solved

Similar Questions

Assume few interfaces, Loan and Insurance and a class Bike.Also lets define a class BenelliBike. Establish relationship between BenelliBike and Bike, Loan and Insurance.public interface Loan {    //some methods}public interface Insurance  {    //some methods}public class Bike  {    //some code}public class BenelliBike   blank  blank  blank  blank{    //some code}implements Loan,Insurance Bike  extends

Chương trình đúng hay sai ?interface A {public void aMethod();}class B implements A{@Overridepublic void aMethod() {}}class C extends B implements A{}

class FourWheeler{    public FourWheeler()    {        System.out.println("Class FourWheeler");    }}class Car extends FourWheeler{    public Car()     {        System.out.println("Class Car");        }}class Audi extends Car{   public Audi()    {        super();        System.out.println("Class Audi");    }}class Driver{    public static void main(String args[])    {        Audi cc=new Audi();    }}

Observe the below code.  You have a class InsurancePolicy and another class VehicleInsurancePolicy that inherits InsurancePolicy.InsurancePolicy.javapublic class InsurancePolicy { private int policyNumber; private String holderName; private double amount; double calculateBonusAmount(){ //some logic return 0; } }VehicleInsurancePolicy.javaclass VehicleInsurancePolicy extends InsurancePolicy { private String vehicleNumber; private int noOfMonths;   double calculateBonusAmount(){ //some logic return 0; }}Which access specifier can be given to the overridden method calculateBonusAmount.

Observe the below code.  You have a class InsurancePolicy and another class VehicleInsurancePolicy that inherits InsurancePolicy.InsurancePolicy.javapublic class InsurancePolicy { private int policyNumber; private String holderName; private double amount; double calculateBonusAmount(){ //some logic return 0; } }VehicleInsurancePolicy.javaclass VehicleInsurancePolicy extends InsurancePolicy { private String vehicleNumber; private int noOfMonths;   double calculateBonusAmount(){ //some logic return 0; }}Which access specifier can be given to the over

1/1

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.