princy raja wrote:class Product
{ void fact(int p)
{ int i,f=1;
for(i=1;i<=p;i++)
f=f*i;
System.out.println("the answer is " +f);
}
}Will this snippet create an object at the time of execution?
What is the answer for the above question?
Please give me the answer....
Well, in order to discuss "time of execution", you actually need execution. So, assuming that the main
thread creates a Product object to do the factorial, then yes. To confirm, you need to show us the code for the main thread.
Henry