Please post the complete code so that it would be easy to understand. e.g.
1) I do not see any main method, so I'm assuming that the code given under mainClass.java is inside main method.
2) What is '2' in first for loop of mainClass? Please avoid using magic numbers (or at least give them a meaningful variable names)
3) What is 'size'? Whose size it is?

You are taking arguments, and overwriting those by class variables. Since you haven't initialized those (again, this is purely my assumption - because you haven't completely posted the code ), those variables are getting initialized by their default values (Object is null, int is 0 and so on).
So, you are actually assigning 0 and null to input parameters before printing it.

I hope this helps.

Regards,
Anayonkar Shivalkar (SCJP, SCWCD, OCMJD, OCEEJBD)

Sara Brown

Ranch Hand

Posts: 55

posted 5 years ago

sorry..this is my program..please do help.

It does not passing the parameter that i hope and keep read as null only the object works properly.

and return numThread in the operation class which i bold, also passing the null value

What Anayonkar is saying (correctly) is that your two assignments are in reverse order: you are assigning the class member TO the local variable, rather than assigning the local variable TO the class member. To prove the point, change the code to this:

By adding final to the input parameter list you prevent yourself from making the mistake you are making. What error do you get? Why?