Please provide definition, explanation and examples
for each topic.
Thanks
Class
A class is an entity that determines how an object will behave
and what the object will contain. In other words,
it is a blueprint or a set of instruction to build a specific type
of object. also a class is a template definition of the method s
and variable s in a particular kind of object . Thus, an object is
a specific instance of a class; it contains real values instead of
variables.
The class is one of the defining ideas of object-oriented programming. Among the important ideas about classes are:
Syntax
class <class_name>{
field;
method;
}
Objects
An object is nothing but a self-contained component which consists of methods and properties to make a particular type of data useful. Object determines the behavior of the class. When you send a message to an object, you are asking the object to invoke or execute one of its methods.an object can be a variable, a data structure, a function, or a method, and as such, is a value in memory referenced by an identifier.
In the class-based object-oriented programming paradigm, object refers to a particular instance of a class, where the object can be a combination of variables, functions, and data structures.
From a programming point of view, an object can be a data
structure, a variable or a function. It has a memory location
allocated. The object is designed as class hierarchies.
Syntax
ClassName ReferenceVariable = new ClassName();
Inherintance
Inheritance is a mechanism in which one class acquires the property of another class. For example, a child inherits the traits of his/her parents. With inheritance, we can reuse the fields and methods of the existing class. Hence, inheritance facilitates Reusability and is an important concept of OOPs.
Types of Inheritance
There are Various types of inheritance in Java:
Single Inheritance:
In Single Inheritance one class extends another class (one class
only).
In above diagram, Class B extends only Class A. Class A is a super class and Class B is a Sub-class.
Multiple Inheritance:
In Multiple Inheritance, one class extending more than one class.
Java does not support multiple inheritance.
As per above diagram, Class C extends Class A and Class B both.
Multilevel Inheritance:
In Multilevel Inheritance, one class can inherit from a derived
class. Hence, the derived class becomes the base class for the new
class.
As per shown in diagram Class C is subclass of B and B is a of subclass Class A.
Hierarchical Inheritance:
In Hierarchical Inheritance, one class is inherited by many sub
classes.
As per above example, Class B, C, and D inherit the same class A.
Hybrid Inheritance:
Hybrid inheritance is a combination of Single and Multiple
inheritance.
As per above example, all the public and protected members of
Class A are inherited into Class D, first via Class B and secondly
via Class C.
example
class Doctor {
void Doctor_Details() {
System.out.println("Doctor Details...");
}
}
class Surgeon extends Doctor {
void Surgeon_Details() {
System.out.println("Surgen Detail...");
}
}
public class Hospital {
public static void main(String args[]) {
Surgeon s = new Surgeon();
s.Doctor_Details();
s.Surgeon_Details();
}
}
here our parent class is Doctor and child class id Surgen thar extends from the Doctor
Polymorphism
Polymorphism is an object-oriented programming concept that refers to the ability of a variable, function or object to take on multiple forms. A language that features polymorphism allows developers to program in the general rather than program in the specific.
In a programming language that exhibits polymorphism, objects of classes belonging to the same hierarchical tree (inherited from a common base class) may possess functions bearing the same name, but each having different behaviors.
As an example, assume there is a base class named Animals from which the subclasses Horse, Fish and Bird are derived. Also assume that the Animals class has a function named Move, which is inherited by all subclasses mentioned. With polymorphism, each subclass may have its own way of implementing the function. So, for example, when the Move function is called in an object of the Horse class, the function might respond by displaying trotting on the screen. On the other hand, when the same function is called in an object of the Fish class, swimming might be displayed on the screen. In the case of a Bird object, it may be flying.
Overriding
In any object-oriented programming language, Overriding is a
feature that allows a subclass or child class to provide a specific
implementation of a
method that is already provided by one of its super-classes or
parent classes. When a method in a subclass has the same name, same
parameters or signature
and same return type(or sub-type) as a method in its super-class,
then the method in the subclass is said to override the method in
the super-class.
Method overriding is one of the way by which java achieve Run Time Polymorphism.The version of a method that is executed will be determined by the object that is used to invoke it. If an object of a parent class is used to invoke the method, then the version in the parent class will be executed, but if an object of the subclass is used to invoke the method, then the version in the child class will be executed.In other words, it is the type of the object being referred to (not the type of the reference variable) that determines which version of an overridden method will be executed.
Overloading
Overloading refers to the ability to use a single identifier to
define multiple methods of a class that differ in their input and
output parameters.
Overloaded methods are generally used when they conceptually
execute the same task but with a slightly different set of
parameters.
If you have any query regarding the answer please ask me in the comment i am here for help you. Please do not direct thumbs down just ask if you have any query. And if you like my work then please appriciates with up vote. Thank You.
Please provide definition, explanation and examples for each topic. Thanks Ob ad
Please write in Bold letters thanks In a sentence or two each, provide examples of each of the following terms and explain why the example illustrates the related concept. Do not use examples from the text but use critical thinking to make up your own. (1 point each) Independent events Dependent events Complementary events Union of events Intersection of events
I need help in this, please write your own definition and make your own examples. Please do not copy anything, It should be plagiarism free Topic List (10 points) 1. Microeconomics 2. Intermediate good 3. Disposable personal income (provide a quantitative example!" 4. Inflation rate (provide a quantitative example." Four Topics (20 points each) 1. Microeconomics Definition/discussion: Example (if required): 2. Intermediate good Definition discussion: Example (if required): 3. Disposable personal income (provide a quantitative example) Definition/discussion: Example (if required):...
Help with these question. Please provide clear detailed explanation. Thanks!
Please give the most simplest, easy to understand, short, straight to the point explanation. I'm struggling. Thanks in advance! (Please don't handwrite it) A. Give two examples of each type of competition: exploitation, interference, interspecific, & intraspecific. B. What is ammensalism? What are two examples of ammensalism? C. What is commensalism? What are two examples of commensalism? D. What is resource portioning? How does it take effect? E. What does resource partitioning do for species that share the same territory?...
Question 1: Provide the definition or explanation of the following terms: (20 marks for each) (a) Autocorrelation (b) R-squared (c) A test of heteroscedasticity (d) F-test (e) The assumption of CLRM
Please provide a detailed explanation for the following. Thanks! Explain why each of the following statements is True, False, or Uncertain according to economic principles. Use diagrams where appropriate. Unsupported answers will receive no marks. It is the explanation that is important. a. The fact that many developing nations have not finished building their wired communication networks and focused on wireless, while most developed nations have maintained their wired, and continued to build out their wireless networks can be explained...
With explanation please -- thanks! 9. (6 pts) Provide IUPAC names for the following structures.
How many unshared electrons are in CH3CONH2? Please provide drawing and explanation for answer. Thanks
Provide a definition for operations research. Then provide at least three examples of the use of OR techniques that assisted a decision maker.
Topic: Lod Checking Circuits ( MW & MV ) Please give a descripeted definition for Line Load Check and provide an example.