How To Implement Access Specifiers In Java
Rate this article
0 out of 5
In this tutorial we will show you how to implement access specifiers in java. After viewing the video tutorial, download the source code and try to modify the code so as to get a feel of what is learned in this video tutorial.

 
Source Code

DEMO.java

// working with private,public,protected access specifiers.

class First
{
      private int a=1;
      protected int b=2;
      public int c=3;
      int d=4;
   
      void display()
     {
            System.out.println(" a = " +a);
            System.out.println(" b = " +b);
            System.out.println(" c = " +c);
            System.out.println(" d = " +d);
      }
}

class Second extends First
{
     void display()
     {
            //System.out.println(" a = " +a);
            System.out.println(" b = " +b);
            System.out.println(" c = " +c);
            System.out.println(" d = " +d);
      }
}  

class Demo
{
      public static void main(String args[])
      {
            Second obj=new Second();
            obj.display();
       }
}




Source Code

About The Author
TekTips Videos

Number Of articles Posted      : 27
Number Of Messages Posted  : 0
Joined Date : 2013/2/04
   
Author
Messages
Posted:
Post Your Comments  
Name (Max 50 Chars)
Comments
 
 

 
TekTipsDownload
GateExam
Academic Projects
TekTipsExperts
Android