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

Author Question: What is wrong in the following code?class TempClass { int i; public void TempClass(int j) {int i = ... (Read 70 times)

fahad

  • Hero Member
  • *****
  • Posts: 570
What is wrong in the following code?

class TempClass {
int i;
public void TempClass(int j) {
int i = j;
}
}

public class C {
public static void main(String[] args) {
TempClass temp = new TempClass(2);
}
}

◦ The program has a compilation error because TempClass does not have a default constructor.
◦ The program compiles and runs fine.
◦ The program compiles fine, but it does not run because class C is not public.
◦ The program has a compilation error because TempClass does not have a constructor with an int argument.


Related Topics

Need homework help now?

Ask unlimited questions for free

Ask a Question
Marked as best answer by fahad on May 6, 2020

marict

  • Sr. Member
  • ****
  • Posts: 304
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




fahad

  • Member
  • Posts: 570
Reply 2 on: May 6, 2020
Wow, this really help


jordangronback

  • Member
  • Posts: 339
Reply 3 on: Yesterday
YES! Correct, THANKS for helping me on my review

 

Did you know?

Calcitonin is a naturally occurring hormone. In women who are at least 5 years beyond menopause, it slows bone loss and increases spinal bone density.

Did you know?

Excessive alcohol use costs the country approximately $235 billion every year.

Did you know?

In 2006, a generic antinausea drug named ondansetron was approved. It is used to stop nausea and vomiting associated with surgery, chemotherapy, and radiation therapy.

Did you know?

Less than one of every three adults with high LDL cholesterol has the condition under control. Only 48.1% with the condition are being treated for it.

Did you know?

Giardia is one of the most common intestinal parasites worldwide, and infects up to 20% of the world population, mostly in poorer countries with inadequate sanitation. Infections are most common in children, though chronic Giardia is more common in adults.

For a complete list of videos, visit our video library