MCQ: Which of the following is not an oops concept in java

Which of the following is NOT an OOP (Object-Oriented Programming) concept in Java? 

A) Encapsulation 

B) Inheritance 

C) Polymorphism 

D) Compilation 

Answer: 

D) Compilation 

Explanation: 

Compilation is not an OOP concept. Object-Oriented Programming (OOP) is a programming paradigm based on the concept of "objects", which can contain data in the form of fields (often known as attributes or properties) and code, in the form of procedures (often known as methods). 

OOP concepts in Java include:

A) Encapsulation: This is the mechanism of wrapping the data (variables) and code acting on the data (methods) together as a single unit. In encapsulation, the variables of a class are hidden from any other class and can be accessed only through any member function of their own class. 

B) Inheritance: This is a mechanism wherein a new class is derived from an existing class. The new class is called the derived class or child class, and the class from which it is derived is called the base class or parent class. It provides the idea of reusability of code and each new class created is the cumulative result of all the classes above it in the inheritance chain. 

C) Polymorphism: This OOP concept allows methods to do different things based on the object it is acting upon. In simple words, polymorphism allows you to define one interface and have multiple implementations. It can be of two types, compile-time (method overloading) and run-time (method overriding). 

D) Compilation: This is not an OOP concept but rather a phase in the software development process. Compilation is converting the source code written in a programming language into machine code that can be executed by a computer. In Java, the source code is compiled into bytecode, which the Java Virtual Machine (JVM) interprets or compiles into native machine code for execution. This process is related to the language's execution model rather than object-oriented features. 


Comments