Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

JAVA 3 - Threads Problem: Inherit a class from Thread and override the run( ) me

ID: 3863355 • Letter: J

Question

JAVA 3 - Threads

Problem:

Inherit a class from Thread and override the run( ) method. Inside run( ), print a message, and then call sleep( ). Repeat this three times, then return from run( ). Put a start-up message in the constructor and override finalize( ) to print a shut-down message. Make a separate thread class that calls System.gc( ) and System.runFinalization( ) inside run( ), printing a message as it does so. Make several thread objects of both types and run them to see what happens.

Requirements: You will submit the following with this lab:

b. Create a folder using your last name as the name of the folder

c. Develop the stack class and test class in that folder

d. When completed, ‘zip’ the contents, and

e. Submit the lab through the Canvas (online sections) or Dropbox (F2F sections) methanisms.

(Need answer ASAP please*)

Explanation / Answer

Solution :

@Override

    protected void finalize() throws Throwable

    {

        System.out.println("This is my shut down message");

super.finalize(); //Calling super class finalize() method explicitly

    }