SlideShare a Scribd company logo
Rectangle class inherits members of Shape class Has one method called "getArea"
"getArea" method should return the area of a rectangle
Solution
Here is code:
class Shape {
//shape class have method getArea return
int getArea(int length, int width)
{
return length * width;
}
}
// rectangle extends shape
class Rectangle extends Shape {
int GetData(int l, int h)
{
return getArea(l, h);
}
public
static void main(String args[])
{
Rectangle obj = new Rectangle();
//get area of rectangle by GetDate
System.out.println("Area is " + obj.GetData(5, 6));
}
}
Output:
Area is 30

More Related Content

PDF
WHICH OF THE FOLLOWING LAB EXPERIMENTS DEMONSTRATIONS BEST REPRESEN.pdf
PDF
What advantage is there in placing the two wires carrying an AC sign.pdf
PDF
What are key benefits of enzymes What are key benefits of enzym.pdf
PDF
Using Linux, while a directory may seem empty because it doesnt co.pdf
PDF
Unlike carbohydrates, proteins, and nucleic acids, lipids are define.pdf
PDF
True or False A characteristic of a variable on interval level is t.pdf
PDF
To understand de Broglie waves and the calculation of wave properties.pdf
PDF
Think about the similarities and differences that benign (non-cancer.pdf
WHICH OF THE FOLLOWING LAB EXPERIMENTS DEMONSTRATIONS BEST REPRESEN.pdf
What advantage is there in placing the two wires carrying an AC sign.pdf
What are key benefits of enzymes What are key benefits of enzym.pdf
Using Linux, while a directory may seem empty because it doesnt co.pdf
Unlike carbohydrates, proteins, and nucleic acids, lipids are define.pdf
True or False A characteristic of a variable on interval level is t.pdf
To understand de Broglie waves and the calculation of wave properties.pdf
Think about the similarities and differences that benign (non-cancer.pdf

More from kamdinrossihoungma74 (20)

PDF
The probability of getting a C in stat is .20. if students attend cl.pdf
PDF
Sally wants to express her gene of interest in E. coli. She inserts .pdf
PDF
Short answers ·GUI elements Static methods and variables Overloading .pdf
PDF
Operating leases have historically been controversial because there .pdf
PDF
Of the ECG traces shown on the back of this page, which one represe.pdf
PDF
Multiple choice of secant functionsI know D isnt the correct ans.pdf
PDF
Part 1 - Written AnswersDownload the GridWriter.zip file and exami.pdf
PDF
Lets suppose that a species of mosquito has two different types of.pdf
PDF
Let X be a random variable with cumulative distribution function F(a.pdf
PDF
John and Mike have been friends since school but havent seen eachoth.pdf
PDF
Java Question help needed In the program Fill the Add statements.pdf
PDF
How can you tell if a URL or Domain is open or closed to the public.pdf
PDF
DataAnswer sheetRound all calculations to at least 4.pdf
PDF
Describe the role of television on politics today with some examples.pdf
PDF
Describe bipolar disorder taking special care to note the time requ.pdf
PDF
Compare and contrast the two major types of networks Solution.pdf
PDF
Answer following questionsHow does the bundling of assets improve.pdf
PDF
Ancient Laws Using the laws listed in the Code of Hammurabi draw some.pdf
PDF
2. What are the DBA’s responsibilities regarding access privileges.pdf
PDF
1- We use a t-test to determine whether two po.pdf
The probability of getting a C in stat is .20. if students attend cl.pdf
Sally wants to express her gene of interest in E. coli. She inserts .pdf
Short answers ·GUI elements Static methods and variables Overloading .pdf
Operating leases have historically been controversial because there .pdf
Of the ECG traces shown on the back of this page, which one represe.pdf
Multiple choice of secant functionsI know D isnt the correct ans.pdf
Part 1 - Written AnswersDownload the GridWriter.zip file and exami.pdf
Lets suppose that a species of mosquito has two different types of.pdf
Let X be a random variable with cumulative distribution function F(a.pdf
John and Mike have been friends since school but havent seen eachoth.pdf
Java Question help needed In the program Fill the Add statements.pdf
How can you tell if a URL or Domain is open or closed to the public.pdf
DataAnswer sheetRound all calculations to at least 4.pdf
Describe the role of television on politics today with some examples.pdf
Describe bipolar disorder taking special care to note the time requ.pdf
Compare and contrast the two major types of networks Solution.pdf
Answer following questionsHow does the bundling of assets improve.pdf
Ancient Laws Using the laws listed in the Code of Hammurabi draw some.pdf
2. What are the DBA’s responsibilities regarding access privileges.pdf
1- We use a t-test to determine whether two po.pdf

Recently uploaded (20)

PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PDF
Complications of Minimal Access Surgery at WLH
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
Microbial disease of the cardiovascular and lymphatic systems
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
VCE English Exam - Section C Student Revision Booklet
PPTX
GDM (1) (1).pptx small presentation for students
PDF
RMMM.pdf make it easy to upload and study
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PPTX
Institutional Correction lecture only . . .
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PPTX
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PPTX
Lesson notes of climatology university.
PPTX
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
PDF
Anesthesia in Laparoscopic Surgery in India
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
Complications of Minimal Access Surgery at WLH
Module 4: Burden of Disease Tutorial Slides S2 2025
O7-L3 Supply Chain Operations - ICLT Program
O5-L3 Freight Transport Ops (International) V1.pdf
Microbial disease of the cardiovascular and lymphatic systems
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
VCE English Exam - Section C Student Revision Booklet
GDM (1) (1).pptx small presentation for students
RMMM.pdf make it easy to upload and study
Supply Chain Operations Speaking Notes -ICLT Program
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
Institutional Correction lecture only . . .
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Tissue processing ( HISTOPATHOLOGICAL TECHNIQUE
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
Lesson notes of climatology university.
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
Anesthesia in Laparoscopic Surgery in India

Rectangle class inherits members of Shape class Has one method calle.pdf

  • 1. Rectangle class inherits members of Shape class Has one method called "getArea" "getArea" method should return the area of a rectangle Solution Here is code: class Shape { //shape class have method getArea return int getArea(int length, int width) { return length * width; } } // rectangle extends shape class Rectangle extends Shape { int GetData(int l, int h) { return getArea(l, h); } public static void main(String args[]) { Rectangle obj = new Rectangle(); //get area of rectangle by GetDate System.out.println("Area is " + obj.GetData(5, 6)); } } Output: Area is 30