Monday 2 April 2018

interfaces in java (Abstraction in OOP)







package javaapplication25;





interface shape

{



    void area();

 

}

class square implements shape

{

float s;

 public void area()

 {

     System.out.println("area of square is "+s*s);

 }





}



public class JavaApplication25 {



   

    public static void main(String[] args)

    {

       square s= new square();

        s.s=10;

       s.area();

   

       

    }

   

}


Abstraction in java (Object Oriented Programming pillar)







package javaapplication24;



abstract class shape

{



public abstract void printarea();



}

class triangle extends shape

{

   float b,h;

public  void printarea()

{

    System.out.println("area of triangle is "+0.5*b*h);

}

}



class square extends shape

{

    float s;

public  void printarea()

{

    System.out.println("area of triangle is "+s*s);

}



}







public class JavaApplication24 {



 

    public static void main(String[] args)

    {

        triangle t=new triangle();

        t.b=5;

        t.h=10;

        t.printarea();

   

        square s=new square();

        s.s=2.5f;

        s.printarea();

   

    }

   

}


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 ...