call a method in an object, by giving the same object as the parameter
hi all,
i want to know about simple java concept,
public class Operator{
//this is a bean class and there is a method to insert object of this class, into the database.
public int saveObject(Operator _operator){
//here are codes for insert the given object in the database.
}//end of the method
}//end of the class
then this is the testing class include main method.
public class testOperator{
public static void main(String[] args){
//create an operator object
Operator op = new Operator();
//then insert this object by calling the "saveObject" method in the //same object
op.saveObject(op);
}
}
Above it save the object using the method in that object,
is this possible.......????
But when I test this, it was properly worked......
pleas anyone can explain me the concept behind this...
thanks..
rpjanaka
Junior Poster in Training
69 posts since Sep 2006
Reputation Points: 10
Solved Threads: 0
I want to know, is this possible, because in that case, that operator object do some operation for itself,
is this possible...?
and is this a bad programming practice...???
rpjanaka
Junior Poster in Training
69 posts since Sep 2006
Reputation Points: 10
Solved Threads: 0