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 69 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
:D TYSM


bblaney

  • Member
  • Posts: 323
Reply 3 on: Yesterday
Great answer, keep it coming :)

 

Did you know?

Since 1988, the CDC has reported a 99% reduction in bacterial meningitis caused by Haemophilus influenzae, due to the introduction of the vaccine against it.

Did you know?

The average person is easily confused by the terms pharmaceutics and pharmacology, thinking they are one and the same. Whereas pharmaceutics is the science of preparing and dispensing drugs (otherwise known as the science of pharmacy), pharmacology is the study of medications.

Did you know?

More than nineteen million Americans carry the factor V gene that causes blood clots, pulmonary embolism, and heart disease.

Did you know?

Multiple experimental evidences have confirmed that at the molecular level, cancer is caused by lesions in cellular DNA.

Did you know?

Acetaminophen (Tylenol) in overdose can seriously damage the liver. It should never be taken by people who use alcohol heavily; it can result in severe liver damage and even a condition requiring a liver transplant.

For a complete list of videos, visit our video library