Regards,
Arun.K
Regards,
Arun.K
Arun kumar.ck wrote:By this code I am doing the same function for two types of records..For that I have repeated the same logic twice in two classes..Other than the numner of parameters passed,there is no other difference between those two classes..
I want to know how use the same funcetionality but with different parameters..
Thus the code will be optimized..
If you see the code correctly,you will find that the same logic is repeated twice in two classes..
Regards,
Arun.K
Arun kumar.ck wrote:I have created two classes(Thread class) to read two types of records(Textfiles-Both have different number of values)..
Both classes does same process but with two type of files(Textfiles-Both have different number of values)..Both class looks same as one..Both class uses same insertion method to insert the textfile data into the database..
I cant condense it because there is nothing rather than the same class is repeated twice..
Arun kumar.ck wrote:Now I want to know,Instead of doing this can we create only one class(Thread class) to do both the functions.
I cant condense it because there is nothing rather than the same class is repeated twice..
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Jeff Verdegan wrote:Also, you shouldn't extend Thread. You should implement Runnable instead.
Tim Moores wrote:See https://coderanch.com/how-to/java/ExtendingThreadVsImplementingRunnable for some discussion. Using Callable or Future may be even better, depending on what you're trying to achieve.
Koen Aerts wrote:
Jeff Verdegan wrote:Also, you shouldn't extend Thread. You should implement Runnable instead.
Why is that better?
Regards,
Arun.K
Consider Paul's rocket mass heater. |