OOPs INTERVIEW QUESTION & ANSWERS
56. |
What are methods? |
|
- Methods are the building blocks of a class, in which they are linked together to share and process data to produce the result.
- Method is a block of code that contains a series of statements.
- A method represents a behavior of a class.
- Methods are declared in a class or a structure by specifying the access level, the return value, the name of the method, and the method parameters.
|
57. |
What is an ArrayList? |
|
The ArrayList object is a collection of items containing a single data type values. |
58. |
What are the significant features of an interface? |
|
- An interface is declared by using the Interface keyword.
- An interface is used to apply multiple inheritance in code.
- An interface is a template that contains only the signature of methods.
|
59. |
What are constructors and destructors? |
|
- Constructors and destructors are special methods of every class.
- Each class has its own constructor and destructor and are called automatically when the instance of a class is created or destroyed.
- The constructor initializes all class members whenever you access the class and the destructor
destroys them when the objects are not required anymore.
|
60. |
What is meant by data encapsulation? |
|
Data encapsulation, also referred to as data hiding, is the mechanism whereby the implementation details of a class are kept hidden from the user. The user can only perform a restricted set of operations on the hidden members of the class by executing special functions called methods. |