More than 100 typical JAVA interview questions and answer analysis (1)
This article will discuss various types of interview questions in Java interviews, which allow employers to test candidate's Java and general Object-Oriented Programming capabilities.
Object-Oriented Programming (OOP)
Java is a computer programming language that supports concurrency, class-based, and object-oriented. The advantages of object-oriented software development are listed below:
-
Code development is modular and easier to maintain and modify.
-
Code reuse.
-
Enhance code reliability and flexibility.
-
Increase the comprehensibility of the Code.
Object-Oriented Programming has many important features, such as encapsulation, inheritance, polymorphism, and abstraction. The following sections analyze these features one by one.
Encapsulation
Encapsulation provides objects with the ability to hide internal characteristics and behaviors. The object provides some methods that can be accessed by other objects to change its internal data. In Java, there are three modifiers: public, private, and protected. Each modifier grants different access permissions to other objects located in the same package or under different packages.
Some advantages of encapsulation are listed below:
-
You can hide the attributes of an object to protect the internal state of the object.
-
This improves code availability and maintainability, because the behavior of objects can be changed or extended independently.
-
Disable poor interaction between objects to improve modularity.
Refer to this document for more information.