Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Any suggestions please???

 
Aaron Buch
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
import java.awt.*;
public class testBean extends java.lang.Object
{
private int i;
public testBean()
{
}
public void settest(int i1) {
i1 = 3;
this.i = i1;

}
public int gettest() {
return this.i;
}
public static void main(String[] args) {
testBean t = new testBean();
System.out.println(t.gettest());
}
}
The output was 0.
But i think it should be 3.
Any suggestions please???
 
Anna s Iyer
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Aaron,
You didn't call the settest() method!. Call it with a parameter and then only the instance variable i will get set to 3.
Hope that helps,
Anna S Iyer.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic