Java Encapsulation Interview Questions
1.
What is the advantage of Encapsulation?
- Encapsulated code ko’proq moslashuvchan va yangi talablar bo’lib
qolsa uni o’zgartirish
ancha oson
- U boshqa class larning uning private fieldlariga to’g’ridan- to’g’ri
murojat qilishini oldini oladi
- U ma’lumotlarni va kodni tashqi voris olingan klasslardan saqlaydi.
Bu bilan
biz xavfsizlikka erishamiz
- U dasturning barqarorligini oshiradi
2.
What is the difference between Abstraction and Encapsulation?
- Abstraction solves the problem
at the design level whereas
encapsulation solves the problem at the implementation level
- Abstractionga interface
va abstract class lar orqali, Encapsulationga
esa private va protected modifer
lar orqali erishiladi
- Abstraction is used to hide the unwanted data and giving relevant
data whereas encapsulation is used for
hiding data and code in a
single unit to prevent access from outside.
3. What is Object Based Programming language?
OOP ga asoslangan lekin Polimorfizm va Inheritanceni qo’llamaydi.
JavaScript - OBP
4.
What are the advantages/benefits of OOPs in Java?
- Security
- Reusablity(qayta ishlatsa bo’ladigan)
- Effective communication(effectiv aloqa)
- Developing complex software(murakkab dastur tuzish)
- Easy upgraded(Oson o’zgartirsa bo’ladigan)
- Easy partition of work(Ishni oson bo’lish)
- Maintenance
- Efficency
5.
How Java compiler differentiate overloaded methods?