I agree that it is best to modify method1() signature, but isn't it possible to add a static variable "X dummy" to the ABC class and then reference it from the method1()? Sure it would be shared by all ABC objects, but that's ok, because it is already shared, since main() is static, too. Here is a modified code:
Joined: Sep 04, 2003
I dont wish to change it to a static variable. Though the main method is static,the variable is still a local variable. Thanks a lot for replying. I guess its not possible.