answersLogoWhite

0

Can override thread's run method

Updated: 8/17/2019
User Avatar

Wiki User

βˆ™ 15y ago

Best Answer

Yes you can very well do...

the run method is nothing but a Java method and all properties applicable to Java methods are applicable to it also.

User Avatar

Wiki User

βˆ™ 15y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Can override thread's run method
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What method must be implemented by all Threads?

The "run" method.


How threads are synchronized in a java?

By using an Runnable and Thread object. EX: Runnable r = new Runnable() { Thread t = new Thread() { @Override public void run() { //place code for new thread here } }; @Override public void run() { t.start(); } }; r.run();


Can you override an instance method and make it final?

No. Once a method is declared final in a class, no derivative of that class can override that method.


Can you override the life cycle methods of a JSP?

You cannot override the jspService() method but you can override the jspInit() and jspDestroy() methods


How can be join the threads?

By using Thread.join() method we can join two threads


Why can't method override be used without inheritance?

Overriding a method means that you are replacing an existing or virtual method that has already been defined in the parent object class, so without using inheritance, there can be no existing method to override.


Any method in a super class can be overridden in its subclass?

False.Any method declared as final cannot be overridden by any subclasses.You also cannot technically override a private method. While your subclass can have a method with the same definition as a private method in the superclass, it does not actually override that method.


Why must you override the hashcode method while overriding the equals method?

Because, if two objects are supposed to be equal as per the equals() method, then the value returned by the hashCode() method must also be the same. This will not be the case if you override only the equals method and this can have some confusing effects when using those objects with hash related collections. So it is always a good idea to override the hashCode() method if you are providing an implementation for the equals method.


Is it possible to override the main method in Java?

Theoretically yes. You will use only one main method for your whole java application and hence such a situation will not come up in real life. Imagine: You have a main in class A and one more in class B which extends class A. When you try to run the class B, only that main method will be executed and not the main in class A. So this override is irrelevant and we cannot call class A's main method at all


What method do you override to initialize instance variables in a JSP declaration?

jsp init()


When do you override the finalize method?

when there is cleanup activity needed before an object is destroyed


What is first call in struts2 default constructor or validate method?

Default Constructor will be called first . If you override Validate method , then validate method will be called .