// Collection of code snippets by Arne Vajhøj 
// (from articles on eksperten.dk / vajhoej.dk written sometime between 2004 and now) 
package classes.inner.bad1;

public class Demo {
	public class Other {
		public class YetAnother {
			private int v;
			public int getV() {
				return v;
			}
			public void setV(int v) {
				this.v = v;
			}
			public void test() {
				System.out.printf("v = %d\n",  getV());
				System.out.printf("this v = %d\n",  this.getV());
				System.out.printf("YetAnother this v = %d\n",  YetAnother.this.getV());
				System.out.printf("Other this v = %d\n",  Other.this.getV());
				System.out.printf("Demo this v = %d\n",  Demo.this.getV());
			}
		}
		private int v;
		public int getV() {
			return v;
		}
		public void setV(int v) {
			this.v = v;
		}
		public void test() {
			YetAnother yao = new YetAnother();
			yao.setV(789);
			yao.test();
		}
	}
	private int v;
	public int getV() {
		return v;
	}
	public void setV(int v) {
		this.v = v;
	}
	public void test() {
		Other other = new Other();
		other.setV(456);
		other.test();
	}
	public static void main(String[] args) {
		Demo demo = new Demo();
		demo.setV(123);
		demo.test();
	}
}

