Multiple choice technology programming languages

When writing a utility class, someclass, which extends mainclass class and will be used by several other classes in a large project. These other classes will be in different packages.Pick the correct class declaration

  1. class someclass extends mainclass

  2. protected class someclass extends mainclass

  3. public class someclass extends mainclass

  4. private class someclass extends mainclass

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

When writing a utility class that extends another class and will be used by multiple classes in different packages, it must be declared 'public' to be accessible outside its own package. 'protected' would only allow subclass access, 'private' would prevent any external access, and the default (package-private) wouldn't allow cross-package use.