AARRRGH Banned
#1

Giblet Registered User
#2

You can only use methods available to Thread if you go
Thread t1 = new Search();

AARRRGH Banned
#3

Hi Giblet

Thanks for the reply. I do have these lines in my code though -

Thread t1 = new Search(largeArray,0,split-1);
Thread t2 = new Search(largeArray,split,x-1);

...followed by...

if (t1.getResult()>t2.getResult())

...which in theory should use...

public int getResult() {
return biggest;
}

Am I not able to do this?

Thanks

hussey Registered User
#4

No ...

You are using the Thread class
Thread doesn't have a getResult method ... search does

try Search t1 = new Search(largeArray,0,split-1);

by Using Thread t1 .. you can only use method available to Thread as it isn't aware of subclass methods

Search is still a 'Thread' though

You should only use
Thread t1 = new Search( .. if you don't care about the underlying methods
if you were only ever going to call run()

AARRRGH Banned
#5

Ah yes, yes, that worked perfectly.

Thank you for taking the time to figure out what the problem is.

Want to share your thoughts?

Login here to discuss!