Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Java by (55.6k points)
Can anyone explain encapsulation in Java in simple words?

1 Answer

0 votes
by (119k points)
edited by

Encapsulation is a data hiding in simple words. Encapsulation is one of the Objective oriented programming concepts of Java. Encapsulation in Java is hiding the variables and its methods of a class to other classes. We can only access this encapsulated data from the methods declared in that class.

We can use encapsulation in Java by using private before variables and public before methods in a class.

I would suggest this Java Certification program by Intellipaat in case you are interested to learn Java.

You can watch this video on the Java tutorial for beginners by Intellipaat:

Related questions

0 votes
1 answer
asked Feb 15, 2021 in Java by sheela_singh (9.5k points)
0 votes
1 answer
asked Mar 2, 2021 in Java by rahulnayar01123 (6.1k points)
0 votes
1 answer
asked May 17, 2023 in Java by neelimakv (32.5k points)
0 votes
1 answer
asked Apr 14, 2021 in Java by dante07 (13.1k points)
0 votes
1 answer

Browse Categories

...