learn java
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 The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Any suggestions please???" Watch "Any suggestions please???" New topic

Any suggestions please???

Aaron Buch

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();
The output was 0.
But i think it should be 3.
Any suggestions please???
Anna s Iyer

Joined: Aug 21, 2000
Posts: 24
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.
Have you tried LearnNowOnline? http://www.learnnowonline.com/
subject: Any suggestions please???