Knowee
Questions
Features
Study Tools

Predict the outputabstract class Vehicle{    abstract void calcPremium(Number N);}interface Insurance{    abstract void calcPremium (Object O);}class Car extends Vehicle implements Insurance{                 public void calcPremium (Object O)                    {                        System.out.println("Object");                    }    void calcPremium (Number N)     {        System.out.println("Number");    } }public class Test{    public static void main(String[] args)    {        Vehicle a = new Car();         a. calcPremium (new Integer(121));          Insurance b = new Car();           b. calcPremium (new Integer(121));           Car c = new Car();            c. calcPremium (new Integer(121));    }}Select one:a.NumberObjectNumberb.NumberNumberObjectc.Run time errord.Compile time error

Question

Predict the outputabstract class Vehicle{    abstract void calcPremium(Number N);}interface Insurance{    abstract void calcPremium (Object O);}class Car extends Vehicle implements Insurance{                 public void calcPremium (Object O)                    {                        System.out.println("Object");                    }    void calcPremium (Number N)     {        System.out.println("Number");    } }public class Test{    public static void main(String[] args)    {        Vehicle a = new Car();         a. calcPremium (new Integer(121));          Insurance b = new Car();           b. calcPremium (new Integer(121));           Car c = new Car();            c. calcPremium (new Integer(121));    }}Select one:a.NumberObjectNumberb.NumberNumberObjectc.Run time errord.Compile time error

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

Solution

a. Number Object Number

Similar Questions

Predict the outputclass Car implements Insurance{        public int calcPremium(int i)    {        return i = i * i;    }}interface Insurance{    int calcPremium(int i);}public class MainClass {    public static void main(String[] args)    {        Insurance b = new Car();        System.out.println(b.calcPremium(2));    }}Select one:a.The output will be 4b.Compile time error because you must create interface before implementing it.c.Compile time error because you cannot create an object of type interface Insuranced.Run time Error

Predict the output of the following program:abstract class Demo{    public int a;    Demo()    {        a = 10;    }    abstract public void set();    abstract final public void get();}class Test extends Demo{    public void set(int a)    {        this.a = a;    }   final public void get()    {        System.out.println("a = " + a);    }    public static void main(String[] args)    {        Test obj = new Test();        obj.set(20);        obj.get();    }}Select one:a.a = 10b.a = 20c.Compilation error

Select the correct answerWhat is the output of the following Java program?public class Vehicle { public void move() { System.out.println("The vehicle moves"); }}public class Car extends Vehicle { public void move() { System.out.println("The car moves"); }}public class Main { public static void main(String[] args) { Vehicle vehicle = new Car(); vehicle.move(); }}Options"The vehicle moves"The code does not compileNone of these"The car moves"

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.

Develop a Java Application with ‘Vehicle’ Class with vehicle type, vehicle number, engine number, chassis number, top speed, number of passengers, number of gears. Generate a report for the vehicles. Implement the concept using Interfaces.Input:CarHRDQ245652WVC12342H2X1234535kph45OutputCarHRDQ245652WVC12342H2X1234535kph45

1/3

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.