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 71 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
Gracias!


billybob123

  • Member
  • Posts: 336
Reply 3 on: Yesterday
:D TYSM

 

Did you know?

Increased intake of vitamin D has been shown to reduce fractures up to 25% in older people.

Did you know?

Signs and symptoms that may signify an eye tumor include general blurred vision, bulging eye(s), double vision, a sensation of a foreign body in the eye(s), iris defects, limited ability to move the eyelid(s), limited ability to move the eye(s), pain or discomfort in or around the eyes or eyelids, red or pink eyes, white or cloud spots on the eye(s), colored spots on the eyelid(s), swelling around the eyes, swollen eyelid(s), and general vision loss.

Did you know?

It is difficult to obtain enough calcium without consuming milk or other dairy foods.

Did you know?

The term pharmacology is derived from the Greek words pharmakon("claim, medicine, poison, or remedy") and logos ("study").

Did you know?

When taking monoamine oxidase inhibitors, people should avoid a variety of foods, which include alcoholic beverages, bean curd, broad (fava) bean pods, cheese, fish, ginseng, protein extracts, meat, sauerkraut, shrimp paste, soups, and yeast.

For a complete list of videos, visit our video library