Please explain why each statement is either true or false, thank you :-) Assume
ID: 3885290 • Letter: P
Question
Please explain why each statement is either true or false, thank you :-)
Assume we need to implment a method in the stack to return the stack size, can we do it as follows in the interface or should we use an abstract class instead? public interface Stack { private int size: public void push(T value){ size++: pushInternal(value): } public T pop(){ size--: return popInternal(): } public int getSize(){ return size: } public void pushInternal(T value): public T popInternal(): no, we should use abstract classes in order to implement a reusable code yes, interfaces are more efficient by design, and are sufficiently enough to design a reusable codeExplanation / Answer
Answer) no, we should use abstract classes in order to implement a reusable code
Explantion:- In interfaces we only define the method the definitions not the code what it does. In abstract classes we can define only method definitions or we can implement the method by writing the code into it.