Data Hiding in Java || What is Data Hiding in Java?
Welcome to Our Java Education Point. In this Post we learn about Data Hiding in Java or Data Hiding. Data Hiding Is Most Famous Concept In java or Other Programming Langauge.
Definations:
After Validation or Identification Outside Person Can access our Internal Data.
OR
Outside Person Cannot Access Our data Directly . This OOPs Feature is nothing But Data Hiding.
OR
Our Internal data should not go out directly that is outside person cannot access our data directly. This OOPs Feature is nothing But Data Hiding.
Examples of Data Hiding:
Example1:- After Providing proper username and password we can able to access our Gmail Inbox Information.
Example2:- Even Though We are valid customer of the Bank . We Can able to access our account Information and we can not access others Account Information.
Note-
By Declaring data member (Variable) as Private we can achieve Data Hiding.Code Example:-
Public class Account
{
private double balance;
-------------------------
-------------------------
-------------------------
-------------------------
}
public double getBalance(){
//Validation
return balace;
}
Comments
Post a Comment