This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
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 OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP 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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Any suggestions please???