Monday, 12 March 2018

Hierarchical inheritance in java





package javaapplication14;



class employee

{

double salary;

}

class developer extends  employee

{

int dvbonus=5000;

String dv_name;



}



class designer extends  employee

{

int debonus=4000;

String de_name;



}







public class JavaApplication14 {



   

    public static void main(String[] args)

    {

        designer de=new designer();

       double salary= de.salary=35000;

      String name= de.de_name="ali";

       System.out.println("Name="+name+"\ntotal salary= "+(salary+de.debonus));

           

       developer d=new developer();

       salary=d.salary=50000;

       name="immad";

         System.out.println("Name="+name+"\ntotal salary= "+(salary+d.dvbonus));



    }

   

}


No comments:

Post a Comment

Pass Dynamically Added Html Table Records List To Controller In Asp.net MVC

Controller Code: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using ...