my dog learned polymorphism*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Any suggestions please??? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Any suggestions please???" Watch "Any suggestions please???" New topic
Author

Any suggestions please???

Aaron Buch
Greenhorn

Joined: Oct 23, 2000
Posts: 17
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

Joined: Aug 21, 2000
Posts: 24
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
 
subject: Any suggestions please???
 
Similar Threads
Method parameters doubt?
Another puzzling question
any suggestions
AXIS Generated WSDL file looks wrong.
servlet , bean , jsp Communication