Computer Science, asked by karajrandhawa71481, 1 year ago

Which two of the following are legal declarations for abstract classes and interfaces?
1. final abstract class Test {}
2. public static interface Test {}
3. final public class Test {}
4. protected abstract class Test {}
5. protected interface Test {}
6. abstract public class Test {}
A.1 and 2
B.2 and 4
C.3 and 5
D.5 and 6

Answers

Answered by Neeraj723
4
Hii dear here is your answer


option b is the correct answer

Hope it's help u
Answered by Jasleen0599
0

Option (C) 3 and 5

The following are legal declarations for abstract classes and interfaces

3. final public class Test {}

5. protected interface Test {}

  • You can design functionality that subclasses can implement or replace by using an abstract class. You cannot actually implement functionality; only specify it using an interface. Additionally, an interface can benefit from numerous classes, but a class can only extend one abstract class.
  • Discover the differences between Java's abstract classes and interfaces by comparing them. Both the Abstract class and the Interface are utilized for abstraction. An interface is a sketch that is used to implement a class, whereas an abstract class has an abstract keyword on the declaration.

#SPJ3

Similar questions