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 77 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


scottmt

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

 

Did you know?

Pubic lice (crabs) are usually spread through sexual contact. You cannot catch them by using a public toilet.

Did you know?

Sildenafil (Viagra®) has two actions that may be of consequence in patients with heart disease. It can lower the blood pressure, and it can interact with nitrates. It should never be used in patients who are taking nitrates.

Did you know?

Asthma cases in Americans are about 75% higher today than they were in 1980.

Did you know?

Signs of depression include feeling sad most of the time for 2 weeks or longer; loss of interest in things normally enjoyed; lack of energy; sleep and appetite disturbances; weight changes; feelings of hopelessness, helplessness, or worthlessness; an inability to make decisions; and thoughts of death and suicide.

Did you know?

A good example of polar molecules can be understood when trying to make a cake. If water and oil are required, they will not mix together. If you put them into a measuring cup, the oil will rise to the top while the water remains on the bottom.

For a complete list of videos, visit our video library