Hi there everybody,
I have a little question:
If I have a class witch extends another class, i.e.:
public class A extends B {
}
The objects I create of A class are type A or type B.
I think I am not explaining myself very well… sorry, English is not my natural tongue.
I want to override the run() method from the Thread class, so I create another class that extends the Thread class
puclic class MyThreadClass extends Thread {
}
So, when I want to create a thread, I have to define the object, but this object must be of type MyThreadClass or Thread?
MyThreadClass myThread = new MyThreadClass();
or
Thread myThread = new MyThreadClass();
I am beguining to read the book “Developing Games in Java (Nrg – Programming)” and the first chapter is about threadings. It says the second option is correct but I am not sure of that…and even I dont understand why.
Again, sorry about my spelling and thanks in advance.