SlideShare a Scribd company logo
When ever you impelemented an interface we must define the abstract methods in that interface
in inheritance class. so that we must define the all methods in that interface (collection)
solved problem:
import java.util.Collection;
import java.util.Iterator;
public class PartialArrayMultiset implements Collection
{
protected E[] _store;
protected int _size;
protected long _modCount;
public PartialArrayMultiset()
{
_modCount=0;
clear();
}
public void clear()
{
_store=(E[])(new Object[16]);
_size=0;
_modCount+=1;
}
public boolean add(E e)
{
if(_size==_store.length)
return false;
_store[_size]=e;
_size++;
return true;
}
public void removeAtIndex(int i)
{
if(i<0 || i>= _size)
throw new ArrayIndexOutOfBoundsException(i);
E oldValue=_store[i];
for(int hole=i;hole<_size-1;hole++)
_store[hole]=_store[hole+1];
_store[_size-1]=null;
_size--;
}
public boolean contains(Object obj)
{
return false;
}
public boolean addAll(Collection arg0) {
// TODO Auto-generated method stub
return false;
}
public boolean containsAll(Collection arg0) {
// TODO Auto-generated method stub
return false;
}
public boolean isEmpty() {
// TODO Auto-generated method stub
return false;
}
public Iterator iterator() {
// TODO Auto-generated method stub
return null;
}
public boolean remove(Object arg0) {
// TODO Auto-generated method stub
return false;
}
public boolean removeAll(Collection arg0) {
// TODO Auto-generated method stub
return false;
}
public boolean retainAll(Collection arg0) {
// TODO Auto-generated method stub
return false;
}
public int size() {
// TODO Auto-generated method stub
return 0;
}
public Object[] toArray() {
// TODO Auto-generated method stub
return null;
}
public T[] toArray(T[] arg0) {
// TODO Auto-generated method stub
return null;
}
}
now use this program and test run y
Solution
When ever you impelemented an interface we must define the abstract methods in that interface
in inheritance class. so that we must define the all methods in that interface (collection)
solved problem:
import java.util.Collection;
import java.util.Iterator;
public class PartialArrayMultiset implements Collection
{
protected E[] _store;
protected int _size;
protected long _modCount;
public PartialArrayMultiset()
{
_modCount=0;
clear();
}
public void clear()
{
_store=(E[])(new Object[16]);
_size=0;
_modCount+=1;
}
public boolean add(E e)
{
if(_size==_store.length)
return false;
_store[_size]=e;
_size++;
return true;
}
public void removeAtIndex(int i)
{
if(i<0 || i>= _size)
throw new ArrayIndexOutOfBoundsException(i);
E oldValue=_store[i];
for(int hole=i;hole<_size-1;hole++)
_store[hole]=_store[hole+1];
_store[_size-1]=null;
_size--;
}
public boolean contains(Object obj)
{
return false;
}
public boolean addAll(Collection arg0) {
// TODO Auto-generated method stub
return false;
}
public boolean containsAll(Collection arg0) {
// TODO Auto-generated method stub
return false;
}
public boolean isEmpty() {
// TODO Auto-generated method stub
return false;
}
public Iterator iterator() {
// TODO Auto-generated method stub
return null;
}
public boolean remove(Object arg0) {
// TODO Auto-generated method stub
return false;
}
public boolean removeAll(Collection arg0) {
// TODO Auto-generated method stub
return false;
}
public boolean retainAll(Collection arg0) {
// TODO Auto-generated method stub
return false;
}
public int size() {
// TODO Auto-generated method stub
return 0;
}
public Object[] toArray() {
// TODO Auto-generated method stub
return null;
}
public T[] toArray(T[] arg0) {
// TODO Auto-generated method stub
return null;
}
}
now use this program and test run y

More Related Content

Similar to When ever you impelemented an interface we must define the abstract .pdf

Java Generics
Java GenericsJava Generics
Java Generics
jeslie
 
Day 5
Day 5Day 5
output and explain There is Mylist There is MyArrayList pa.pdf
output and explain There is Mylist There is MyArrayList pa.pdfoutput and explain There is Mylist There is MyArrayList pa.pdf
output and explain There is Mylist There is MyArrayList pa.pdf
access2future1
 
Infinum Android Talks #20 - DiffUtil
Infinum Android Talks #20 - DiffUtilInfinum Android Talks #20 - DiffUtil
Infinum Android Talks #20 - DiffUtil
Infinum
 
Hello. I need help fixing this Java Code on Eclipse. Please fix part.pdf
Hello. I need help fixing this Java Code on Eclipse. Please fix part.pdfHello. I need help fixing this Java Code on Eclipse. Please fix part.pdf
Hello. I need help fixing this Java Code on Eclipse. Please fix part.pdf
flashfashioncasualwe
 
J2ME Lwuit, Storage & Connections (Ft Prasanjit Dey)
J2ME Lwuit, Storage & Connections (Ft   Prasanjit Dey)J2ME Lwuit, Storage & Connections (Ft   Prasanjit Dey)
J2ME Lwuit, Storage & Connections (Ft Prasanjit Dey)
Fafadia Tech
 
Object Oriented Solved Practice Programs C++ Exams
Object Oriented Solved Practice Programs C++ ExamsObject Oriented Solved Practice Programs C++ Exams
Object Oriented Solved Practice Programs C++ Exams
MuhammadTalha436
 
Java осень 2012 лекция 2
Java осень 2012 лекция 2Java осень 2012 лекция 2
Java осень 2012 лекция 2Technopark
 
Introduction to kotlin
Introduction to kotlinIntroduction to kotlin
Introduction to kotlin
Shaul Rosenzwieg
 
C++ Course - Lesson 2
C++ Course - Lesson 2C++ Course - Lesson 2
C++ Course - Lesson 2Mohamed Ahmed
 
M|18 User Defined Functions
M|18 User Defined FunctionsM|18 User Defined Functions
M|18 User Defined Functions
MariaDB plc
 
Intake 38 5
Intake 38 5Intake 38 5
Intake 38 5
Mahmoud Ouf
 
Points.java import java.util.ArrayList; import java.util.Scan.pdf
 Points.java import java.util.ArrayList; import java.util.Scan.pdf Points.java import java.util.ArrayList; import java.util.Scan.pdf
Points.java import java.util.ArrayList; import java.util.Scan.pdf
KUNALHARCHANDANI1
 
From clever code to better code
From clever code to better codeFrom clever code to better code
From clever code to better code
Dror Helper
 

Similar to When ever you impelemented an interface we must define the abstract .pdf (20)

Java Generics
Java GenericsJava Generics
Java Generics
 
Day 5
Day 5Day 5
Day 5
 
Java practical
Java practicalJava practical
Java practical
 
output and explain There is Mylist There is MyArrayList pa.pdf
output and explain There is Mylist There is MyArrayList pa.pdfoutput and explain There is Mylist There is MyArrayList pa.pdf
output and explain There is Mylist There is MyArrayList pa.pdf
 
Infinum Android Talks #20 - DiffUtil
Infinum Android Talks #20 - DiffUtilInfinum Android Talks #20 - DiffUtil
Infinum Android Talks #20 - DiffUtil
 
Introduction to-java
Introduction to-javaIntroduction to-java
Introduction to-java
 
Hello. I need help fixing this Java Code on Eclipse. Please fix part.pdf
Hello. I need help fixing this Java Code on Eclipse. Please fix part.pdfHello. I need help fixing this Java Code on Eclipse. Please fix part.pdf
Hello. I need help fixing this Java Code on Eclipse. Please fix part.pdf
 
Csharp_Chap13
Csharp_Chap13Csharp_Chap13
Csharp_Chap13
 
J2ME Lwuit, Storage & Connections (Ft Prasanjit Dey)
J2ME Lwuit, Storage & Connections (Ft   Prasanjit Dey)J2ME Lwuit, Storage & Connections (Ft   Prasanjit Dey)
J2ME Lwuit, Storage & Connections (Ft Prasanjit Dey)
 
Object Oriented Solved Practice Programs C++ Exams
Object Oriented Solved Practice Programs C++ ExamsObject Oriented Solved Practice Programs C++ Exams
Object Oriented Solved Practice Programs C++ Exams
 
Java осень 2012 лекция 2
Java осень 2012 лекция 2Java осень 2012 лекция 2
Java осень 2012 лекция 2
 
Introduction to kotlin
Introduction to kotlinIntroduction to kotlin
Introduction to kotlin
 
C++ Course - Lesson 2
C++ Course - Lesson 2C++ Course - Lesson 2
C++ Course - Lesson 2
 
Thread
ThreadThread
Thread
 
Applications
ApplicationsApplications
Applications
 
M|18 User Defined Functions
M|18 User Defined FunctionsM|18 User Defined Functions
M|18 User Defined Functions
 
Intake 38 5
Intake 38 5Intake 38 5
Intake 38 5
 
Java Generics
Java GenericsJava Generics
Java Generics
 
Points.java import java.util.ArrayList; import java.util.Scan.pdf
 Points.java import java.util.ArrayList; import java.util.Scan.pdf Points.java import java.util.ArrayList; import java.util.Scan.pdf
Points.java import java.util.ArrayList; import java.util.Scan.pdf
 
From clever code to better code
From clever code to better codeFrom clever code to better code
From clever code to better code
 

More from ankurelectronicsg3

SH bond is more polar Solution .pdf
                     SH bond is more polar Solution               .pdf                     SH bond is more polar Solution               .pdf
SH bond is more polar Solution .pdf
ankurelectronicsg3
 
It is ionic solid (compound). It will be more sol.pdf
                     It is ionic solid (compound). It will be more sol.pdf                     It is ionic solid (compound). It will be more sol.pdf
It is ionic solid (compound). It will be more sol.pdf
ankurelectronicsg3
 
IUPAC name 1-ethoxy-2-methylpropane other name.pdf
                     IUPAC name 1-ethoxy-2-methylpropane  other name.pdf                     IUPAC name 1-ethoxy-2-methylpropane  other name.pdf
IUPAC name 1-ethoxy-2-methylpropane other name.pdf
ankurelectronicsg3
 
I get B .pdf
                     I get B                                      .pdf                     I get B                                      .pdf
I get B .pdf
ankurelectronicsg3
 
Evaporation at 20°C is negligible. HgO decomposes.pdf
                     Evaporation at 20°C is negligible. HgO decomposes.pdf                     Evaporation at 20°C is negligible. HgO decomposes.pdf
Evaporation at 20°C is negligible. HgO decomposes.pdf
ankurelectronicsg3
 
E) Mg is the reducing agent and Cu^2+ is the oxid.pdf
                     E) Mg is the reducing agent and Cu^2+ is the oxid.pdf                     E) Mg is the reducing agent and Cu^2+ is the oxid.pdf
E) Mg is the reducing agent and Cu^2+ is the oxid.pdf
ankurelectronicsg3
 
D 1 and 2 only .pdf
                     D 1 and 2 only                                   .pdf                     D 1 and 2 only                                   .pdf
D 1 and 2 only .pdf
ankurelectronicsg3
 
cannot see the fig. .pdf
                     cannot see the fig.                              .pdf                     cannot see the fig.                              .pdf
cannot see the fig. .pdf
ankurelectronicsg3
 
boiling point KCl CH2O CO2 note KCl is ioni.pdf
                     boiling point KCl  CH2O  CO2 note KCl is ioni.pdf                     boiling point KCl  CH2O  CO2 note KCl is ioni.pdf
boiling point KCl CH2O CO2 note KCl is ioni.pdf
ankurelectronicsg3
 
C formation of enolate .pdf
                     C formation of enolate                           .pdf                     C formation of enolate                           .pdf
C formation of enolate .pdf
ankurelectronicsg3
 
A is right option beacuse H2O will attack on carb.pdf
                     A is right option beacuse H2O will attack on carb.pdf                     A is right option beacuse H2O will attack on carb.pdf
A is right option beacuse H2O will attack on carb.pdf
ankurelectronicsg3
 
Fifi eventhough is a male; it is possible to clone it to have a dupl.pdf
  Fifi eventhough is a male; it is possible to clone it to have a dupl.pdf  Fifi eventhough is a male; it is possible to clone it to have a dupl.pdf
Fifi eventhough is a male; it is possible to clone it to have a dupl.pdf
ankurelectronicsg3
 
Please post the picture , it is not visible to me.pdf
                     Please post the picture , it is not visible to me.pdf                     Please post the picture , it is not visible to me.pdf
Please post the picture , it is not visible to me.pdf
ankurelectronicsg3
 
one. If there was more than one proton, they woul.pdf
                     one. If there was more than one proton, they woul.pdf                     one. If there was more than one proton, they woul.pdf
one. If there was more than one proton, they woul.pdf
ankurelectronicsg3
 
Moles of Cu present = 0.57663.5 = 0.00907 1L ha.pdf
                     Moles of Cu present = 0.57663.5 = 0.00907  1L ha.pdf                     Moles of Cu present = 0.57663.5 = 0.00907  1L ha.pdf
Moles of Cu present = 0.57663.5 = 0.00907 1L ha.pdf
ankurelectronicsg3
 
In R2, the only non-trivial subspaces are lines p.pdf
                     In R2, the only non-trivial subspaces are lines p.pdf                     In R2, the only non-trivial subspaces are lines p.pdf
In R2, the only non-trivial subspaces are lines p.pdf
ankurelectronicsg3
 
first one is far more acidic due to high inductiv.pdf
                     first one is far more acidic due to high inductiv.pdf                     first one is far more acidic due to high inductiv.pdf
first one is far more acidic due to high inductiv.pdf
ankurelectronicsg3
 
Wait I am doing it ...please rate 5 ..Ill post the answer in comme.pdf
Wait I am doing it ...please rate 5 ..Ill post the answer in comme.pdfWait I am doing it ...please rate 5 ..Ill post the answer in comme.pdf
Wait I am doing it ...please rate 5 ..Ill post the answer in comme.pdf
ankurelectronicsg3
 
WhereSolutionWhere.pdf
WhereSolutionWhere.pdfWhereSolutionWhere.pdf
WhereSolutionWhere.pdf
ankurelectronicsg3
 
ThereSolutionThere.pdf
ThereSolutionThere.pdfThereSolutionThere.pdf
ThereSolutionThere.pdf
ankurelectronicsg3
 

More from ankurelectronicsg3 (20)

SH bond is more polar Solution .pdf
                     SH bond is more polar Solution               .pdf                     SH bond is more polar Solution               .pdf
SH bond is more polar Solution .pdf
 
It is ionic solid (compound). It will be more sol.pdf
                     It is ionic solid (compound). It will be more sol.pdf                     It is ionic solid (compound). It will be more sol.pdf
It is ionic solid (compound). It will be more sol.pdf
 
IUPAC name 1-ethoxy-2-methylpropane other name.pdf
                     IUPAC name 1-ethoxy-2-methylpropane  other name.pdf                     IUPAC name 1-ethoxy-2-methylpropane  other name.pdf
IUPAC name 1-ethoxy-2-methylpropane other name.pdf
 
I get B .pdf
                     I get B                                      .pdf                     I get B                                      .pdf
I get B .pdf
 
Evaporation at 20°C is negligible. HgO decomposes.pdf
                     Evaporation at 20°C is negligible. HgO decomposes.pdf                     Evaporation at 20°C is negligible. HgO decomposes.pdf
Evaporation at 20°C is negligible. HgO decomposes.pdf
 
E) Mg is the reducing agent and Cu^2+ is the oxid.pdf
                     E) Mg is the reducing agent and Cu^2+ is the oxid.pdf                     E) Mg is the reducing agent and Cu^2+ is the oxid.pdf
E) Mg is the reducing agent and Cu^2+ is the oxid.pdf
 
D 1 and 2 only .pdf
                     D 1 and 2 only                                   .pdf                     D 1 and 2 only                                   .pdf
D 1 and 2 only .pdf
 
cannot see the fig. .pdf
                     cannot see the fig.                              .pdf                     cannot see the fig.                              .pdf
cannot see the fig. .pdf
 
boiling point KCl CH2O CO2 note KCl is ioni.pdf
                     boiling point KCl  CH2O  CO2 note KCl is ioni.pdf                     boiling point KCl  CH2O  CO2 note KCl is ioni.pdf
boiling point KCl CH2O CO2 note KCl is ioni.pdf
 
C formation of enolate .pdf
                     C formation of enolate                           .pdf                     C formation of enolate                           .pdf
C formation of enolate .pdf
 
A is right option beacuse H2O will attack on carb.pdf
                     A is right option beacuse H2O will attack on carb.pdf                     A is right option beacuse H2O will attack on carb.pdf
A is right option beacuse H2O will attack on carb.pdf
 
Fifi eventhough is a male; it is possible to clone it to have a dupl.pdf
  Fifi eventhough is a male; it is possible to clone it to have a dupl.pdf  Fifi eventhough is a male; it is possible to clone it to have a dupl.pdf
Fifi eventhough is a male; it is possible to clone it to have a dupl.pdf
 
Please post the picture , it is not visible to me.pdf
                     Please post the picture , it is not visible to me.pdf                     Please post the picture , it is not visible to me.pdf
Please post the picture , it is not visible to me.pdf
 
one. If there was more than one proton, they woul.pdf
                     one. If there was more than one proton, they woul.pdf                     one. If there was more than one proton, they woul.pdf
one. If there was more than one proton, they woul.pdf
 
Moles of Cu present = 0.57663.5 = 0.00907 1L ha.pdf
                     Moles of Cu present = 0.57663.5 = 0.00907  1L ha.pdf                     Moles of Cu present = 0.57663.5 = 0.00907  1L ha.pdf
Moles of Cu present = 0.57663.5 = 0.00907 1L ha.pdf
 
In R2, the only non-trivial subspaces are lines p.pdf
                     In R2, the only non-trivial subspaces are lines p.pdf                     In R2, the only non-trivial subspaces are lines p.pdf
In R2, the only non-trivial subspaces are lines p.pdf
 
first one is far more acidic due to high inductiv.pdf
                     first one is far more acidic due to high inductiv.pdf                     first one is far more acidic due to high inductiv.pdf
first one is far more acidic due to high inductiv.pdf
 
Wait I am doing it ...please rate 5 ..Ill post the answer in comme.pdf
Wait I am doing it ...please rate 5 ..Ill post the answer in comme.pdfWait I am doing it ...please rate 5 ..Ill post the answer in comme.pdf
Wait I am doing it ...please rate 5 ..Ill post the answer in comme.pdf
 
WhereSolutionWhere.pdf
WhereSolutionWhere.pdfWhereSolutionWhere.pdf
WhereSolutionWhere.pdf
 
ThereSolutionThere.pdf
ThereSolutionThere.pdfThereSolutionThere.pdf
ThereSolutionThere.pdf
 

Recently uploaded

Fresher’s Quiz 2023 at GMC Nizamabad.pptx
Fresher’s Quiz 2023 at GMC Nizamabad.pptxFresher’s Quiz 2023 at GMC Nizamabad.pptx
Fresher’s Quiz 2023 at GMC Nizamabad.pptx
SriSurya50
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
amberjdewit93
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
AyyanKhan40
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
Academy of Science of South Africa
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
thanhdowork
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Akanksha trivedi rama nursing college kanpur.
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
Israel Genealogy Research Association
 
kitab khulasah nurul yaqin jilid 1 - 2.pptx
kitab khulasah nurul yaqin jilid 1 - 2.pptxkitab khulasah nurul yaqin jilid 1 - 2.pptx
kitab khulasah nurul yaqin jilid 1 - 2.pptx
datarid22
 
Reflective and Evaluative Practice PowerPoint
Reflective and Evaluative Practice PowerPointReflective and Evaluative Practice PowerPoint
Reflective and Evaluative Practice PowerPoint
amberjdewit93
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
camakaiclarkmusic
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
ak6969907
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
David Douglas School District
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
tarandeep35
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdfMASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
goswamiyash170123
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
Celine George
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Excellence Foundation for South Sudan
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 

Recently uploaded (20)

Fresher’s Quiz 2023 at GMC Nizamabad.pptx
Fresher’s Quiz 2023 at GMC Nizamabad.pptxFresher’s Quiz 2023 at GMC Nizamabad.pptx
Fresher’s Quiz 2023 at GMC Nizamabad.pptx
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
 
PIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf IslamabadPIMS Job Advertisement 2024.pdf Islamabad
PIMS Job Advertisement 2024.pdf Islamabad
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
 
Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
 
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama UniversityNatural birth techniques - Mrs.Akanksha Trivedi Rama University
Natural birth techniques - Mrs.Akanksha Trivedi Rama University
 
The Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collectionThe Diamonds of 2023-2024 in the IGRA collection
The Diamonds of 2023-2024 in the IGRA collection
 
kitab khulasah nurul yaqin jilid 1 - 2.pptx
kitab khulasah nurul yaqin jilid 1 - 2.pptxkitab khulasah nurul yaqin jilid 1 - 2.pptx
kitab khulasah nurul yaqin jilid 1 - 2.pptx
 
Reflective and Evaluative Practice PowerPoint
Reflective and Evaluative Practice PowerPointReflective and Evaluative Practice PowerPoint
Reflective and Evaluative Practice PowerPoint
 
CACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdfCACJapan - GROUP Presentation 1- Wk 4.pdf
CACJapan - GROUP Presentation 1- Wk 4.pdf
 
World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024World environment day ppt For 5 June 2024
World environment day ppt For 5 June 2024
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
Pride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School DistrictPride Month Slides 2024 David Douglas School District
Pride Month Slides 2024 David Douglas School District
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdfMASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
MASS MEDIA STUDIES-835-CLASS XI Resource Material.pdf
 
How to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP ModuleHow to Add Chatter in the odoo 17 ERP Module
How to Add Chatter in the odoo 17 ERP Module
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
 
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptxChapter 4 - Islamic Financial Institutions in Malaysia.pptx
Chapter 4 - Islamic Financial Institutions in Malaysia.pptx
 

When ever you impelemented an interface we must define the abstract .pdf

  • 1. When ever you impelemented an interface we must define the abstract methods in that interface in inheritance class. so that we must define the all methods in that interface (collection) solved problem: import java.util.Collection; import java.util.Iterator; public class PartialArrayMultiset implements Collection { protected E[] _store; protected int _size; protected long _modCount; public PartialArrayMultiset() { _modCount=0; clear(); } public void clear() { _store=(E[])(new Object[16]); _size=0; _modCount+=1; } public boolean add(E e) { if(_size==_store.length) return false; _store[_size]=e; _size++; return true; } public void removeAtIndex(int i) { if(i<0 || i>= _size) throw new ArrayIndexOutOfBoundsException(i); E oldValue=_store[i]; for(int hole=i;hole<_size-1;hole++)
  • 2. _store[hole]=_store[hole+1]; _store[_size-1]=null; _size--; } public boolean contains(Object obj) { return false; } public boolean addAll(Collection arg0) { // TODO Auto-generated method stub return false; } public boolean containsAll(Collection arg0) { // TODO Auto-generated method stub return false; } public boolean isEmpty() { // TODO Auto-generated method stub return false; } public Iterator iterator() { // TODO Auto-generated method stub return null; } public boolean remove(Object arg0) { // TODO Auto-generated method stub return false; } public boolean removeAll(Collection arg0) { // TODO Auto-generated method stub
  • 3. return false; } public boolean retainAll(Collection arg0) { // TODO Auto-generated method stub return false; } public int size() { // TODO Auto-generated method stub return 0; } public Object[] toArray() { // TODO Auto-generated method stub return null; } public T[] toArray(T[] arg0) { // TODO Auto-generated method stub return null; } } now use this program and test run y Solution When ever you impelemented an interface we must define the abstract methods in that interface in inheritance class. so that we must define the all methods in that interface (collection) solved problem: import java.util.Collection; import java.util.Iterator; public class PartialArrayMultiset implements Collection { protected E[] _store; protected int _size;
  • 4. protected long _modCount; public PartialArrayMultiset() { _modCount=0; clear(); } public void clear() { _store=(E[])(new Object[16]); _size=0; _modCount+=1; } public boolean add(E e) { if(_size==_store.length) return false; _store[_size]=e; _size++; return true; } public void removeAtIndex(int i) { if(i<0 || i>= _size) throw new ArrayIndexOutOfBoundsException(i); E oldValue=_store[i]; for(int hole=i;hole<_size-1;hole++) _store[hole]=_store[hole+1]; _store[_size-1]=null; _size--; } public boolean contains(Object obj) { return false; } public boolean addAll(Collection arg0) {
  • 5. // TODO Auto-generated method stub return false; } public boolean containsAll(Collection arg0) { // TODO Auto-generated method stub return false; } public boolean isEmpty() { // TODO Auto-generated method stub return false; } public Iterator iterator() { // TODO Auto-generated method stub return null; } public boolean remove(Object arg0) { // TODO Auto-generated method stub return false; } public boolean removeAll(Collection arg0) { // TODO Auto-generated method stub return false; } public boolean retainAll(Collection arg0) { // TODO Auto-generated method stub return false; } public int size() { // TODO Auto-generated method stub
  • 6. return 0; } public Object[] toArray() { // TODO Auto-generated method stub return null; } public T[] toArray(T[] arg0) { // TODO Auto-generated method stub return null; } } now use this program and test run y