Important Java Interview Questions - Part 7
I'm sharing my experience with you as these are the questions which have been asked to me while interviewing on java profile. Where have u used abstraction and encapsulation in your project? We use encapsulation everywhere in java like when we create a class in java we are using encapsulation. Abstraction we use when we create abstract class or interface using abstraction in java. " Encapsulation is to hide the variables or something inside a class, preventing unauthorized parties to use. So the public methods like getter and setter access it and the other classes call these methods for accessing" Using Encapsulation we achieve “Data Hiding, Information Hiding” in java. Encapsulation binds data (attributes and methods) and the code in the form of a class. Encapsulation is the technique of making the fields in a class private and providing access to the fields via public methods. Encapsulation provides “ access control ” through which we can control