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 extends Salary {}class Manager imports Salary {}None of the mentionedclass Manager implements Salary {}
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 extends Salary {}class Manager imports Salary {}None of the mentionedclass Manager implements Salary {}
Solution
The correct answer is "class Manager implements Salary {}"
In Java, a class can implement an interface using the keyword 'implements'. The 'extends' keyword is used when one class inherits from another class. The 'imports' keyword is used to import a package or a class into another class or interface. Therefore, the correct way to implement an interface in Java is using the 'implements' keyword.
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 extends A{}class B imports A{}None of the mentionedclass B implements A{}
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 does not have a body?OptionsAn InterfaceA ClassAn Abstract MethodNone of the mentioned
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.