File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Any suggestions please???

 
Aaron Buch
Greenhorn
Posts: 17
  • 0
  • 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
  • 0
  • 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.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic