Data Hiding

Data Hiding

In this tutorial, we will discuss data hiding in Java. Data hiding is a software development technique primarily used in object oriented programming (OOP) to hide internal object details (data members).

Data Hiding
  • The data should not go out directly i.e., outside person is not allowed to access the data this is nothing but “Data Hiding”.
  • The main advantage of data hiding is we can achieve security.
  • By using private modifier we can achieve this.
package com.ashok.
/**
 * 
 * @author ashok.mariyala
 *
 */
public class Student {
   private String sid;
   private String sname;
   private String saddr;
}
  • It is highly recommended to declare data members with private modifier.
Data Hiding
Scroll to top