Q: Which language is strictly object-oriented, enforcing the use of classes for all code?
-
A
C
-
B
C++
-
C
Java
-
D
None of the above
C
Answer:
C
Explanation:
Java is designed as a strictly object-oriented language, meaning that all code must be part of a class. Even basic constructs, like standalone functions, must be placed within a class structure, aligning Java with object-oriented principles. In Java, primitive data types, such as int and float, also have wrapper classes (e.g., Integer and Float), allowing developers to use them in an object-oriented way. C is a procedural language, without any support for object-oriented programming (OOP), while C++ is multi-paradigm, supporting both procedural and object-oriented programming. Although C++ provides extensive OOP features, it doesn’t enforce strict adherence to OOP, allowing procedural-style code as well. Java’s strict OOP nature ensures a consistent programming structure, enhancing modularity, reusability, and scalability in application design.
Related Topic:
Share Above MCQ