Java

Java - 'this' keyword

Java - 'this' keyword
class Box

  {

     double width, height, depth;

     Box(double w, double h, double dd)

    {

        this.width = w;

        this.height = h;

        this.depth = dd;

    }

    void display()

     {

        System.out.println("\n"+"Volume of the Box is..."+ (width*height*depth)+"\n");

     }

   public static void main(String arg[])

    {

      Box a,b;

      a = new Box(5,10,15);

      a.display();

      b = new Box(10,15,20);

      b.display();

    }
Senthilvelan Sambamoorthy

Senthilvelan Sambamoorthy is working as a Professor in Department of Master of Computer Applications, Paavai Engineering College, Namakkal, Tamilnadu, India, He is Masters in Computers Applications. Having 18+ years of experience and his area of interest is Java, JSP, Servlet, J2EE, C#, PHP, Python ASP.NET, SQL Server and etc.