but in this code I can,t understand why Line 1 and Line 2 written here (I have commented Line 1 and 2 above code)? I need some explain about above codes segments
I am new guy to the java programming. I have written down some java code segments and I need to understand more about creating following array and assign values to it.
public void print(){
System.out.println(a);
System.out.println(b);
}
public void setB(int b){this.b=b;} //what is this
public int getB(){return b;} // and this
}
class Demo{
public static void main(String args[]){
Test t1=new Test();
System.out.println(t1.a);
System.out.println(t1.getB());
t1.setB(1000);
System.out.println(t1.getB());
}
}
I have comment above code. how we can use this in java code