반응형
    
    
    
  package org.tutorials.javatutorial;
class thisClass {
	int x = 10;
	
	void thisMeth() {
		int x = 20;
		System.out.println(x); //20
		System.out.println(this.x); //10
	}
	
}
public class ScopeDemo {
	
	public static void main(String[] args) {
		thisClass c1 = new thisClass();
		c1.thisMeth();
	}
}
반응형
    
    
    
  'Java' 카테고리의 다른 글
| [Java] 생성자, super (0) | 2021.03.09 | 
|---|---|
| [Java] 생성자 (0) | 2021.03.08 | 
| [Java] 클래스 멤버, 인스턴스 멤버 (0) | 2021.03.07 | 
| [Java] 클래스변수 (0) | 2021.03.07 | 
| [Java] 인스턴스, class (0) | 2021.03.05 | 
 
									
								 
									
								 
									
								