Q:

Java - 'this' keyword

0

This Program is used to Constructor and this keyword concept

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

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();

    }

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now