this Keyword with Method in java, Methods to call another Method from same Class.

Java Programming Language Class, Object and Methods in java (Article) Class, Object and Methods in java (Program)

1639

Program:

 class Classthis{

	 void first_method(){
	  System.out.println("Inside FIRST Method");
	  }

	  void second_method(){
	  System.out.println("Inside second Method");
	  this.first_method();// same as calling first_method()
 }

 public static void main(String[] args) {
  Classthis obj = new Classthis();
  obj.second_method();
  }

}

  /*
this keyword can also be used inside Methods
to call another Method from same Class.
*/

Output:

Inside second Method
Inside FIRST Method
Press any key to continue . . .

This Particular section is dedicated to Programs only. If you want learn more about Java Programming Language. Then you can visit below links to get more depth on this subject.