SlideShare a Scribd company logo
1 of 1
Download to read offline
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

More from kamdinrossihoungma74

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

More from kamdinrossihoungma74 (20)

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

Recently uploaded

ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701bronxfugly43
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docxPoojaSen20
 
Role Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptxRole Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptxNikitaBankoti2
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesEnergy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesShubhangi Sonawane
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxnegromaestrong
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin ClassesCeline George
 

Recently uploaded (20)

ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Role Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptxRole Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesEnergy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Seal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptxSeal of Good Local Governance (SGLG) 2024Final.pptx
Seal of Good Local Governance (SGLG) 2024Final.pptx
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 

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