by Dinesh Thakur Category: Classes

 

 class worker

         {
             String n,f;
              int b;
              worker(String x,String y,int z)
                  {
                      n=x;
                      f=y;
                      b=z;
                  }
                      void disp()
                          {
                              System.out.println("Name : "+n);
                              System.out.println("Father's Name : "+f);
                              System.out.println("Basic : "+b);
                          }
       }
               class emp extends worker
                    {
                       String desig;
                       emp(String x,String y, int z, String k)
                            {
                               super(x,y,z);
                              desig=k;
                            }
                              void displ()
                                    {
                                        System.out.println("Desigmation : "+desig);
                                    }
                   }
                          class worksuploasl
                                   {
                                        public static void main(String args[])
                                   {
                                                emp e=new emp("Sandeep Aggarwal","Mr. Rajesh Aggarwal",45000,"Manager");
                                        e.disp();
                                        e.displ();
                                   }
                           }

Example of Super Class By Feeding Employee Detail



About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.



Related Articles