2. Universitas Teknokrat Indonesia
Jalan Zaenal Abidin Pagar Alam No 9-11, Labuhan Ratu,
Kedaton, Bandar Lampung, Lampung 35132
Objectives Theory Conclusion Assignment
ENCAPSULATION
o Encapsulation is the technique of making the
fields in a class private and providing access
to the fields via public methods
(INFORMATION HIDING & INTERFACE TO
ACCESS DATA)
o Encapsulation also can be described as a
protective barrier that prevents the code
and data being randomly accessed by other
code defined outside the class.
3. Universitas Teknokrat Indonesia
Jalan Zaenal Abidin Pagar Alam No 9-11, Labuhan Ratu,
Kedaton, Bandar Lampung, Lampung 35132
Objectives Theory Conclusion Assignment
MODIFIER/VISIBILITY
Modifier Class Package Sub Class All Class
Private Y
Default Y Y
Protected Y Y Y
Public Y Y Y Y
4. Universitas Teknokrat Indonesia
Jalan Zaenal Abidin Pagar Alam No 9-11, Labuhan Ratu,
Kedaton, Bandar Lampung, Lampung 35132
Objectives Theory Conclusion Assignment
Conclusion
o Hiding the details of how
the object works: The only
part of the object that is
accessible to the outside
world is its behaviors.
What happens inside those
behaviors and how the
state is stored is hidden
from view.
5. Universitas Teknokrat Indonesia
Jalan Zaenal Abidin Pagar Alam No 9-11, Labuhan Ratu,
Kedaton, Bandar Lampung, Lampung 35132
Objectives Theory Conclusion Assignment
Assignment 1
Menampilkan data mahasiswa
dari NPM dan Nama yang
diinputkan (gunakan Scanner)
6. Universitas Teknokrat Indonesia
Jalan Zaenal Abidin Pagar Alam No 9-11, Labuhan Ratu,
Kedaton, Bandar Lampung, Lampung 35132
Objectives Theory Conclusion Assignment
Assignment 2
Lengkapi atribut (beserta
method set n get) berupa
alamat, no hp, email, Instagram