Analyze 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);
}
}
```
a. The program has a compile error because TempClass does not have a default constructor.
b. The program has a compile error because TempClass does not have a constructor with an int argument.
c. The program compiles fine, but it does not run because class C is not public.
d. The program compiles and runs fine.


b. The program has a compile error because TempClass does not have a constructor with an int argument.
The program would be fine if the void keyword is removed from public void TempClass(int j).

Computer Science & Information Technology

You might also like to view...

The function's header and footer contain the ____ keyword.

A. Sub B. FunctionProcedure C. SubFunction D. Function

Computer Science & Information Technology

Business reports typically use formats defined in business communication references

Indicate whether the statement is true or false

Computer Science & Information Technology

A(n) ________ app is a Windows app that uses a common code base to deliver the app to any Windows device

Fill in the blank(s) with correct word

Computer Science & Information Technology

In the ADT list, when an item is inserted into position i of the list, ______.

a) the position of all items is increased by 1 b) the position of each item that was at a position smaller than i is increased by 1 c) the position of each item that was at a position greater than i is increased by 1 d) the position of each item that was at a position smaller than i is decreased by 1 while the position of each item that was at a position greater than i is increased by 1

Computer Science & Information Technology