This topic contains a solution. Click here to go to the answer

Author Question: Why does the following class have a syntax error?import java.applet.*;public class Test extends ... (Read 24 times)

s.tung

  • Hero Member
  • *****
  • Posts: 577
Why does the following class have a syntax error?

import java.applet.*;

public class Test extends Applet implements Runnable {
public void init() throws InterruptedException {
Thread t = new Thread(this);
t.sleep(1000);
}

public synchronized void run() {
}
}

◦ You cannot put the keyword synchronized in the run() method.
◦ The sleep() method is not invoked correctly; it should be invoked as Thread.sleep(1000).
◦ The sleep() method should be put in the try-catch block. This is the only reason for the compilation failure.
◦ The init() method is defined in the Applet class, and it is overridden incorrectly because it cannot claim exceptions in the subclass.


Related Topics

Need homework help now?

Ask unlimited questions for free

Ask a Question
Marked as best answer by s.tung on May 6, 2020

mk6555

  • Sr. Member
  • ****
  • Posts: 310
Lorsum iprem. Lorsus sur ipci. Lorsem sur iprem. Lorsum sur ipdi, lorsem sur ipci. Lorsum sur iprium, valum sur ipci et, vala sur ipci. Lorsem sur ipci, lorsa sur iprem. Valus sur ipdi. Lorsus sur iprium nunc, valem sur iprium. Valem sur ipdi. Lorsa sur iprium. Lorsum sur iprium. Valem sur ipdi. Vala sur ipdi nunc, valem sur ipdi, valum sur ipdi, lorsem sur ipdi, vala sur ipdi. Valem sur iprem nunc, lorsa sur iprium. Valum sur ipdi et, lorsus sur ipci. Valem sur iprem. Valem sur ipci. Lorsa sur iprium. Lorsem sur ipci, valus sur iprem. Lorsem sur iprem nunc, valus sur iprium.
Answer Preview
Only 39% of students answer this correctly




s.tung

  • Member
  • Posts: 577
Reply 2 on: May 6, 2020
Gracias!


JCABRERA33

  • Member
  • Posts: 344
Reply 3 on: Yesterday
Thanks for the timely response, appreciate it

 

Did you know?

The types of cancer that alpha interferons are used to treat include hairy cell leukemia, melanoma, follicular non-Hodgkin's lymphoma, and AIDS-related Kaposi's sarcoma.

Did you know?

Hip fractures are the most serious consequences of osteoporosis. The incidence of hip fractures increases with each decade among patients in their 60s to patients in their 90s for both women and men of all populations. Men and women older than 80 years of age show the highest incidence of hip fractures.

Did you know?

There are over 65,000 known species of protozoa. About 10,000 species are parasitic.

Did you know?

Always store hazardous household chemicals in their original containers out of reach of children. These include bleach, paint, strippers and products containing turpentine, garden chemicals, oven cleaners, fondue fuels, nail polish, and nail polish remover.

Did you know?

Over time, chronic hepatitis B virus and hepatitis C virus infections can progress to advanced liver disease, liver failure, and hepatocellular carcinoma. Unlike other forms, more than 80% of hepatitis C infections become chronic and lead to liver disease. When combined with hepatitis B, hepatitis C now accounts for 75% percent of all cases of liver disease around the world. Liver failure caused by hepatitis C is now leading cause of liver transplants in the United States.

For a complete list of videos, visit our video library