Chaturaka Gunatilaka wrote:When I executed the code,I got the output as Sub.myMethod 0. But I was expecting Sub.myMethod 200.What went wrong?Why am I wrong?
Won't tell you that, you need to ShowSomeEffort (←click); but I will ask you this:
What happens when new Sub() gets executed? EXACTLY. If you're not sure, look it up (you may find some useful stuff here) and write it down. Then apply it to your problem and see what you come up with.
Bats fly at night, 'cause they aren't we. And if we tried, we'd hit a tree -- Ogden Nash (or should've been).
Articles by Winston can be found here