SEARCH
You are in browse mode. You must login to use MEMORY

   Log in to start

level: Level 1

Questions and Answers List

level questions: Level 1

QuestionAnswer
Concepts in javaclass, objects, abstraction, encapsulation, inheritance, and polymorphism
What is encapsulation?Data hiding: Encapsulation is the process of hiding unwanted information, such as restricting access to any member of an object. Data binding: Encapsulation is the process of binding the data members and the methods together as a whole, as a class.
What is Polymorphism?“poly” which means “many”, and “morph” which means “shapes”. Therefore Polymorphism refers to something that has many shapes. Polymorphism refers to the process by which some code, data, method, or object behaves differently under different circumstances or contexts Compile-time polymorphism (static polymorphism) and Run time polymorphism (dynamic polymorphism) are the two types of polymorphisms
What is meant by Inheritance?inheritance is the mechanism by which an object or class (referred to as a child) is created using the definition of another object or class (referred to as a parent). Inheritance not only helps to keep the implementation simpler but also helps to facilitate code reuse.
What is Abstraction?Abstraction is the method of hiding unnecessary details from the necessary ones. For example, consider a car. You only need to know how to run a car, and not how the wires are connected inside it. This is obtained using Abstraction.
What is a constructor?Constructors are special methods whose name is the same as the class name. The constructors serve the special purpose of initializing the objects. For example, suppose there is a class with the name “MyClass”, then when you instantiate this class, you pass the syntax: MyClass myClassObject = new MyClass();
What is inheritance? and the various types ?Inheritance is one of the major features of object-oriented programming, by which an entity inherits some characteristics and behaviors of some other entity and makes them their own. Inheritance helps to improve and facilitate code reuse. The various types of inheritance include: Single inheritance Multiple inheritances Multi-level inheritance Hierarchical inheritance Hybrid inheritance
Define a superclass?Superclass is also a part of Inheritance. The superclass is an entity, which allows subclasses or child classes to inherit from itself.
What is the difference between overloading and overriding?Overloading is a compile-time polymorphism feature in which an entity has multiple implementations with the same name. Overriding is a runtime polymorphism feature in which an entity has the same name, but its implementation changes during execution