by Dinesh Thakur Category: Introduction to Java

 

class Rectangle

          {
               int l,b,a;
               void setValue(int x,int y)
                   {
                       this.l=x;
                       this.b=y;
                   }
                   int area()
                      {
                              a=this.l*this.b;
                              return (this.a);
                          }
          };
                   class DemonstrationthisPointer
                      {
                          public static void main(String args[])
                             {
                                 Rectangle rect = new Rectangle();
                                 rect.setValue(58,8);
                                 System.out.println("Area of Rectangle is : "+rect.area());
                             }
                      };

Demonstration of this Pointer



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.