donaricano-btn

This keyword


1. Usage of java this keyword

1) this keyword can be used to refer current class instance variable

2) this() can be used to invoke current class constructor

3) this keyword can be used to invoke current class method

4) this can be passed as an argument in the method call

5) this can be passed as an argument in the constructor call

6) this keyword can also be used to return the current class instance

2. Without this keyword


- We use a this key word to distinguish between local variable and instance variable

- we have a this 

 

- If local variables and instance variables are different, there is no need to use this keyword


'Back-End > Java_1' 카테고리의 다른 글

[Java] Input by BufferedReader  (0) 2016.08.22
[Java] Input by Scanner  (0) 2016.08.18
[Java] Static_2  (0) 2016.07.26
[Java] Constructor_2  (0) 2016.07.26
[Java] Method Overloading  (0) 2016.07.25
블로그 이미지

리딩리드

,