OOPS Concept in Java
Overview Most import aspects of OOPS Data Hiding. Outside person can't access our internal data directly or our internal data should not go out directly, this OOP feature is nothing but Data Hiding. After validation or authentication outside person can access our internal data. By declaring data member (variable) as private we can achieve Data Hiding. e.g. public class Person { final private String name ; final private int age ; public Person (String name , int age) { this . name = name ; this . age = age ; } public String getName () { // Validation return name ; } public int getAge () { // Validation return age ; } } The main advantage of Data Hiding is security. e.g. After providing proper username and password, we can able to access our Gmail inbox information. Even though we are valid customer of the bank, we can able to access our account information but we can't access other's account