Data Hiding

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