Sunday, January 31, 2016

ThisUses

package Constructor;

public class ThisUses {

int a;
int b;

void test1(int a, int b){
this.a = a;
this.b = b;
}

void test2(int p, int H){
a = p;
b = H;
}

void display(){
System.out.println("Value of a and b:-"+a+","+b);
}
public static void main(String[] args) {

ThisUses obj = new ThisUses();

//obj.test1(4, 5);

obj.test2(6, 7);

obj.display();

}

}

No comments:

Post a Comment