📢 Too many exams? Don’t know which one suits you best? Book Your Free Expert 👉 call Now!


    Question

    What is a "final" class in

    Java?
    A A class that cannot be instantiated. Correct Answer Incorrect Answer
    B A class that cannot be inherited by other classes. Correct Answer Incorrect Answer
    C A class that can only have final methods. Correct Answer Incorrect Answer
    D A class that must be abstract. Correct Answer Incorrect Answer
    E A class that cannot have any fields. Correct Answer Incorrect Answer

    Solution

    A final class cannot be extended or inherited by any other class. This is often used for security reasons or to ensure that the class's behavior cannot be altered by subclasses (e.g., String class in Java is final).

    Practice Next
    ask-question