Can not reference class in java -
class myclass { int value; } public myclass test(){ myclass mc; mymethod(mc, 100); if (mc!=null) { mc = mc.value; return mc; } return mc; } public int mymethod(myclass mc, int a) { mc.value = + 10; return mc; }
i want make mc reference. if objective-c similar this:
public myclass test(){ myclass *mc; mymethod(&mc, 100); }
please me. answer appreciate. thank in advanced.
in java use reference variables instead of pointers. see this , this
class myclass { int value; /*all methods have belong class*/ public myclass test() { /*myclass mc; don't need pass assign value value assigned data members of object(reference variable) calls function*/ myclass mc = mymethod(100); return mc; } public myclass mymethod(int a) { value = + 10; return this; //this 'this' return current object } }
Comments
Post a Comment