Computer Science, asked by pallavighuge800, 11 months ago

a java class c has just one constructor and that is declared as protected.
Option:
1. This is illegal & will result in a complier error.
2. This declaration is worthless because it is not possible to create an instance of c.
3. Such a class is useful if class C has a static method that can create and return new insurance of C.
4.Such a class is useful if there exist another class drived from C and this derived class has a constructor that uses the super keyword.

Answers

Answered by cutegirl72
46

I think the last option

Answered by anvitanvar032
0

Answer:

The correct answer to this question is a class is useful if there exists another class derived from C and this derived class has a constructor that uses the super keyword

Explanation:

Given - A java class c has just one constructor.

To Find - Choose the correct option.

Such a class is useful if there exists another class derived from C and this derived class has a constructor that uses the super keyword is a java class c has just one constructor and that is declared as protected.

When a function Object() { [native code] } is protected, users are prevented from creating a class instance outside of the package. If a variable or method is protected during overriding, it can only be overridden by another subclass using the public or protected modifier. Interfaces and outside classes are not protected. Constructors may use public, protected, and private modifiers. When building a singleton class in Java, we may utilise a private function Object() { [native code] }.

#SPJ2

Similar questions