h1.post-title { color:orange; font-family:verdana,Arial; font-weight:bold; padding-bottom:5px; text-shadow:#64665b 0px 1px 1px; font-size:32px; } -->

Pages

Define rules of Constructors


  • Its name must be same as "classname".
  •  It must be defined as "public method".
  •  It can be defined with/without arguments.
  •  It can't return any value. So, no return type specification is required.
  • "Constructor overloading" is possible. Writing multiple constructors in the same class is called as "Constructor overloading".

Define “this” Keyword

This is similar to ―this pointer in C++.
 It represents current working object.
 It is used to access the members of current working object.

  • this.field
  • this.property
  • this.method()

Current object: The object, with which object, the method is called.
this” keyword can‘t be used in the static methods, because static methods doesn‘t have current object.