Select the correct answerA class Manager wants to implement an interface Salary. Which of the following is the correct way of implementing it?Optionsclass Manager implements Salary {}class Manager extends Salary {}class Manager imports Salary {}None of the mentioned
Question
Select the correct answerA class Manager wants to implement an interface Salary. Which of the following is the correct way of implementing it?Optionsclass Manager implements Salary {}class Manager extends Salary {}class Manager imports Salary {}None of the mentioned
Solution
The correct answer is "class Manager implements Salary {}". In Java, a class uses the keyword "implements" to inherit from an interface. The keyword "extends" is used for class to class inheritance and "imports" is used to include packages or classes. Therefore, the correct way to implement an interface is using the keyword "implements".
Similar Questions
rect answerA class Manager wants to implement an interface Salary. Which of the following is the correct way of implementing it?
Select the correct answerWhich of the following is the correct way of implementing an interface A by class B?Optionsclass B implements A{}class B extends A{}class B imports A{}None of the mentioned
1. Select four (4) statements taht can be onserted at line n1.CODE:public class Employee { public int salary;}public class Manager extends Employee { public int budget;}public class Director extends Manager { public int stockOptions;} public static void main(String[] args) { Employee employee = new Employee(); Manager manager = new Manager(); Director director = new Director(); //line n1 }}CHOICES:- employee.salary = 50000- director. salary = 80000- employee.budget = 20000- manager.budget = 100000- manager.stockOptions = 500;- director.stockOptions = 1000;
Select the correct answerWhich of the following is used for implementing inheritance through an interface?Optionsusinginheritedextendsimplements
Select the correct answerWhich of the following is the correct way of implementing an interface NPTEL by class Java?Optionsclass Java implements NPTEL {}class Java extends NPTEL {}class Java imports NPTEL {}none of these
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.