Sunday, January 31, 2016

TestThisinJava

package Constructor;

public class TestThisinJava {

int a;
int b;
int c;
static int d;

void test1() {
this.test2();
System.out.println("I am test one");
}

void test2() {

System.out.println("I am test two");
}

static void test3(int a) {

System.out.println(" I am test three");
}

void test4(TestThisinJava obj) {
System.out.println("method is invoked");
System.out.println(obj.getClass().getName());

}

void test5() {
test4(this);
test3(4);
}

public static void main(String[] args) {
// TODO Auto-generated method stub

TestThisinJava obj = new TestThisinJava();
obj.test5();

obj.test1();


}

}

1 comment:

  1. Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging.

    Java Training in Electronic city

    ReplyDelete