SlideShare a Scribd company logo
Can someone tell me why I'm getting Java error cannot invoke add(int) on array type int on the
bold line? I need this method to calculate median based on file that will be input in a different
method. Do no change to a main method as I need to reserve that to only have a contructor.
public int Problem7(File file) throws FileNotFoundException {
int[] listInt;
try {
Scanner scanner = new Scanner(file);
while (scanner.hasNextLine()) {
String value = scanner.nextLine();
listInt.add(Integer.parseInt(value));
System.out.println(value);
}
scanner.close();
} catch (Exception ex) {
ex.printStackTrace();
}
Arrays.sort(listInt);
int middle = listInt.length/2;
int median = 0;
if (listInt.length%2 == 1)
median = listInt[middle];
else
median = (listInt[middle-1] + listInt[middle]) / 2;
return median;
}}

More Related Content

Similar to Can someone tell me why I'm getting Java error cannot invoke add(int).pdf

Why following sort does not work (It does not sort last 2 - 3 numbe.pdf
Why following sort does not work (It does not sort last 2 - 3 numbe.pdfWhy following sort does not work (It does not sort last 2 - 3 numbe.pdf
Why following sort does not work (It does not sort last 2 - 3 numbe.pdf
gopalk44
 
Recursive decomposition
Recursive decompositionRecursive decomposition
Recursive decompositionhanis salwan
 
Here is my code for a linefile editor Please help me figure out wh.pdf
Here is my code for a linefile editor Please help me figure out wh.pdfHere is my code for a linefile editor Please help me figure out wh.pdf
Here is my code for a linefile editor Please help me figure out wh.pdf
pratyushraj61
 
Unit 3
Unit 3 Unit 3
Unit 3
GOWSIKRAJAP
 
Please I am trying to get this code to output in -txt file- I need you.pdf
Please I am trying to get this code to output in -txt file- I need you.pdfPlease I am trying to get this code to output in -txt file- I need you.pdf
Please I am trying to get this code to output in -txt file- I need you.pdf
asenterprisestyagi
 
Javaa. The mean of a list of numbers is its arithmetic average. T.pdf
Javaa. The mean of a list of numbers is its arithmetic average. T.pdfJavaa. The mean of a list of numbers is its arithmetic average. T.pdf
Javaa. The mean of a list of numbers is its arithmetic average. T.pdf
RAJATCHUGH12
 
2.(Sorted list array implementation)This sorted list ADT discussed .pdf
2.(Sorted list array implementation)This sorted list ADT discussed .pdf2.(Sorted list array implementation)This sorted list ADT discussed .pdf
2.(Sorted list array implementation)This sorted list ADT discussed .pdf
arshin9
 
Array list
Array listArray list
Array list
vishal choudhary
 
JAVALAB #8 - ARRAY BASED LISTSThe next exercise is based on this.pdf
JAVALAB #8 - ARRAY BASED LISTSThe next exercise is based on this.pdfJAVALAB #8 - ARRAY BASED LISTSThe next exercise is based on this.pdf
JAVALAB #8 - ARRAY BASED LISTSThe next exercise is based on this.pdf
arpaqindia
 
Step 1 Implement the getSortedRunLength() methodImplement the get.pdf
Step 1 Implement the getSortedRunLength() methodImplement the get.pdfStep 1 Implement the getSortedRunLength() methodImplement the get.pdf
Step 1 Implement the getSortedRunLength() methodImplement the get.pdf
aloeplusint
 
Create a Queue class that implements a queue abstraction. A queue is.docx
Create a Queue class that implements a queue abstraction. A queue is.docxCreate a Queue class that implements a queue abstraction. A queue is.docx
Create a Queue class that implements a queue abstraction. A queue is.docx
rajahchelsey
 
UserInputHandlerjava package midterm2023 import javautil.pdf
UserInputHandlerjava package midterm2023 import javautil.pdfUserInputHandlerjava package midterm2023 import javautil.pdf
UserInputHandlerjava package midterm2023 import javautil.pdf
adityknits
 
java set1 program.pdf
java set1 program.pdfjava set1 program.pdf
java set1 program.pdf
722820106121SARANS
 
Working effectively with legacy code
Working effectively with legacy codeWorking effectively with legacy code
Working effectively with legacy codeShriKant Vashishtha
 
OrderTest.javapublic class OrderTest {       Get an arra.pdf
OrderTest.javapublic class OrderTest {         Get an arra.pdfOrderTest.javapublic class OrderTest {         Get an arra.pdf
OrderTest.javapublic class OrderTest {       Get an arra.pdf
akkhan101
 
Java interface and inheritance
Java interface and inheritanceJava interface and inheritance
Java interface and inheritance
JaromirJagr
 
Basic data-structures-v.1.1
Basic data-structures-v.1.1Basic data-structures-v.1.1
Basic data-structures-v.1.1
BG Java EE Course
 

Similar to Can someone tell me why I'm getting Java error cannot invoke add(int).pdf (20)

Why following sort does not work (It does not sort last 2 - 3 numbe.pdf
Why following sort does not work (It does not sort last 2 - 3 numbe.pdfWhy following sort does not work (It does not sort last 2 - 3 numbe.pdf
Why following sort does not work (It does not sort last 2 - 3 numbe.pdf
 
Oop lecture7
Oop lecture7Oop lecture7
Oop lecture7
 
Recursive decomposition
Recursive decompositionRecursive decomposition
Recursive decomposition
 
Here is my code for a linefile editor Please help me figure out wh.pdf
Here is my code for a linefile editor Please help me figure out wh.pdfHere is my code for a linefile editor Please help me figure out wh.pdf
Here is my code for a linefile editor Please help me figure out wh.pdf
 
Unit 3
Unit 3 Unit 3
Unit 3
 
Please I am trying to get this code to output in -txt file- I need you.pdf
Please I am trying to get this code to output in -txt file- I need you.pdfPlease I am trying to get this code to output in -txt file- I need you.pdf
Please I am trying to get this code to output in -txt file- I need you.pdf
 
Javaa. The mean of a list of numbers is its arithmetic average. T.pdf
Javaa. The mean of a list of numbers is its arithmetic average. T.pdfJavaa. The mean of a list of numbers is its arithmetic average. T.pdf
Javaa. The mean of a list of numbers is its arithmetic average. T.pdf
 
2.(Sorted list array implementation)This sorted list ADT discussed .pdf
2.(Sorted list array implementation)This sorted list ADT discussed .pdf2.(Sorted list array implementation)This sorted list ADT discussed .pdf
2.(Sorted list array implementation)This sorted list ADT discussed .pdf
 
Array list
Array listArray list
Array list
 
JAVALAB #8 - ARRAY BASED LISTSThe next exercise is based on this.pdf
JAVALAB #8 - ARRAY BASED LISTSThe next exercise is based on this.pdfJAVALAB #8 - ARRAY BASED LISTSThe next exercise is based on this.pdf
JAVALAB #8 - ARRAY BASED LISTSThe next exercise is based on this.pdf
 
Step 1 Implement the getSortedRunLength() methodImplement the get.pdf
Step 1 Implement the getSortedRunLength() methodImplement the get.pdfStep 1 Implement the getSortedRunLength() methodImplement the get.pdf
Step 1 Implement the getSortedRunLength() methodImplement the get.pdf
 
Sam wd programs
Sam wd programsSam wd programs
Sam wd programs
 
Create a Queue class that implements a queue abstraction. A queue is.docx
Create a Queue class that implements a queue abstraction. A queue is.docxCreate a Queue class that implements a queue abstraction. A queue is.docx
Create a Queue class that implements a queue abstraction. A queue is.docx
 
UserInputHandlerjava package midterm2023 import javautil.pdf
UserInputHandlerjava package midterm2023 import javautil.pdfUserInputHandlerjava package midterm2023 import javautil.pdf
UserInputHandlerjava package midterm2023 import javautil.pdf
 
java set1 program.pdf
java set1 program.pdfjava set1 program.pdf
java set1 program.pdf
 
Working effectively with legacy code
Working effectively with legacy codeWorking effectively with legacy code
Working effectively with legacy code
 
OrderTest.javapublic class OrderTest {       Get an arra.pdf
OrderTest.javapublic class OrderTest {         Get an arra.pdfOrderTest.javapublic class OrderTest {         Get an arra.pdf
OrderTest.javapublic class OrderTest {       Get an arra.pdf
 
Java interface and inheritance
Java interface and inheritanceJava interface and inheritance
Java interface and inheritance
 
3 j unit
3 j unit3 j unit
3 j unit
 
Basic data-structures-v.1.1
Basic data-structures-v.1.1Basic data-structures-v.1.1
Basic data-structures-v.1.1
 

More from aonetelecompune

Cardiovascular drift as a result of dehydration caused by sweat loss d.pdf
Cardiovascular drift as a result of dehydration caused by sweat loss d.pdfCardiovascular drift as a result of dehydration caused by sweat loss d.pdf
Cardiovascular drift as a result of dehydration caused by sweat loss d.pdf
aonetelecompune
 
Carbon cioxide ( CO2) is readily soluble in water- according to the eq.pdf
Carbon cioxide ( CO2) is readily soluble in water- according to the eq.pdfCarbon cioxide ( CO2) is readily soluble in water- according to the eq.pdf
Carbon cioxide ( CO2) is readily soluble in water- according to the eq.pdf
aonetelecompune
 
Capstone project topic Wireless Infrastructure in the Cloud Wireless d.pdf
Capstone project topic Wireless Infrastructure in the Cloud Wireless d.pdfCapstone project topic Wireless Infrastructure in the Cloud Wireless d.pdf
Capstone project topic Wireless Infrastructure in the Cloud Wireless d.pdf
aonetelecompune
 
Capsule Staining Staphylococcus aureus- Escherichia coli- Bacillus meg.pdf
Capsule Staining Staphylococcus aureus- Escherichia coli- Bacillus meg.pdfCapsule Staining Staphylococcus aureus- Escherichia coli- Bacillus meg.pdf
Capsule Staining Staphylococcus aureus- Escherichia coli- Bacillus meg.pdf
aonetelecompune
 
Can you site your sources for the information given please Step 1- Res.pdf
Can you site your sources for the information given please Step 1- Res.pdfCan you site your sources for the information given please Step 1- Res.pdf
Can you site your sources for the information given please Step 1- Res.pdf
aonetelecompune
 
Can you please provide a example of how these linux commands are used.pdf
Can you please provide a example of how these linux commands are used.pdfCan you please provide a example of how these linux commands are used.pdf
Can you please provide a example of how these linux commands are used.pdf
aonetelecompune
 
Capital Markets provide which of the following to a firm- (Select all.pdf
Capital Markets provide which of the following to a firm- (Select all.pdfCapital Markets provide which of the following to a firm- (Select all.pdf
Capital Markets provide which of the following to a firm- (Select all.pdf
aonetelecompune
 
Capital flight is Question 32 options- 1) 2) 3).pdf
Capital flight is Question 32 options-             1)      2)      3).pdfCapital flight is Question 32 options-             1)      2)      3).pdf
Capital flight is Question 32 options- 1) 2) 3).pdf
aonetelecompune
 
Capillaries are better for material exchange because compared to arter.pdf
Capillaries are better for material exchange because compared to arter.pdfCapillaries are better for material exchange because compared to arter.pdf
Capillaries are better for material exchange because compared to arter.pdf
aonetelecompune
 
Can this be done with an Arduino Uno- if so can I get pictures of how.pdf
Can this be done with an Arduino Uno- if so can I get pictures of how.pdfCan this be done with an Arduino Uno- if so can I get pictures of how.pdf
Can this be done with an Arduino Uno- if so can I get pictures of how.pdf
aonetelecompune
 
Can someone Please solve Question 1 part B - Thanks!.pdf
Can someone Please solve Question 1 part B -  Thanks!.pdfCan someone Please solve Question 1 part B -  Thanks!.pdf
Can someone Please solve Question 1 part B - Thanks!.pdf
aonetelecompune
 
Canada's Quota on European Cheese- In 2021- Canada imposed a quota on.pdf
Canada's Quota on European Cheese- In 2021- Canada imposed a quota on.pdfCanada's Quota on European Cheese- In 2021- Canada imposed a quota on.pdf
Canada's Quota on European Cheese- In 2021- Canada imposed a quota on.pdf
aonetelecompune
 
Charles named several programs and philosophies that are integral to t.pdf
Charles named several programs and philosophies that are integral to t.pdfCharles named several programs and philosophies that are integral to t.pdf
Charles named several programs and philosophies that are integral to t.pdf
aonetelecompune
 
Chapters 5 - 11 book is Human Resource Management in Health Care princ.pdf
Chapters 5 - 11 book is Human Resource Management in Health Care princ.pdfChapters 5 - 11 book is Human Resource Management in Health Care princ.pdf
Chapters 5 - 11 book is Human Resource Management in Health Care princ.pdf
aonetelecompune
 
Chapter Review Questions Labeling Itentifu she thene ratanovien of mur (1).pdf
Chapter Review Questions Labeling Itentifu she thene ratanovien of mur (1).pdfChapter Review Questions Labeling Itentifu she thene ratanovien of mur (1).pdf
Chapter Review Questions Labeling Itentifu she thene ratanovien of mur (1).pdf
aonetelecompune
 
Chapter 8 sample study questions What is the difference between a Lang.pdf
Chapter 8 sample study questions What is the difference between a Lang.pdfChapter 8 sample study questions What is the difference between a Lang.pdf
Chapter 8 sample study questions What is the difference between a Lang.pdf
aonetelecompune
 
Chapter 6 Define virus- viroid- virion- prion- provirus- reverse trans.pdf
Chapter 6 Define virus- viroid- virion- prion- provirus- reverse trans.pdfChapter 6 Define virus- viroid- virion- prion- provirus- reverse trans.pdf
Chapter 6 Define virus- viroid- virion- prion- provirus- reverse trans.pdf
aonetelecompune
 
Chapter 7 Discussion Key Handling This chapter discusses the importanc.pdf
Chapter 7 Discussion Key Handling This chapter discusses the importanc.pdfChapter 7 Discussion Key Handling This chapter discusses the importanc.pdf
Chapter 7 Discussion Key Handling This chapter discusses the importanc.pdf
aonetelecompune
 
Can someone pls explain the table- FOr the labelled A to E- How do you.pdf
Can someone pls explain the table- FOr the labelled A to E- How do you.pdfCan someone pls explain the table- FOr the labelled A to E- How do you.pdf
Can someone pls explain the table- FOr the labelled A to E- How do you.pdf
aonetelecompune
 
Chapter 4- Trees- Show that if any complete- balanced tree has three c.pdf
Chapter 4- Trees- Show that if any complete- balanced tree has three c.pdfChapter 4- Trees- Show that if any complete- balanced tree has three c.pdf
Chapter 4- Trees- Show that if any complete- balanced tree has three c.pdf
aonetelecompune
 

More from aonetelecompune (20)

Cardiovascular drift as a result of dehydration caused by sweat loss d.pdf
Cardiovascular drift as a result of dehydration caused by sweat loss d.pdfCardiovascular drift as a result of dehydration caused by sweat loss d.pdf
Cardiovascular drift as a result of dehydration caused by sweat loss d.pdf
 
Carbon cioxide ( CO2) is readily soluble in water- according to the eq.pdf
Carbon cioxide ( CO2) is readily soluble in water- according to the eq.pdfCarbon cioxide ( CO2) is readily soluble in water- according to the eq.pdf
Carbon cioxide ( CO2) is readily soluble in water- according to the eq.pdf
 
Capstone project topic Wireless Infrastructure in the Cloud Wireless d.pdf
Capstone project topic Wireless Infrastructure in the Cloud Wireless d.pdfCapstone project topic Wireless Infrastructure in the Cloud Wireless d.pdf
Capstone project topic Wireless Infrastructure in the Cloud Wireless d.pdf
 
Capsule Staining Staphylococcus aureus- Escherichia coli- Bacillus meg.pdf
Capsule Staining Staphylococcus aureus- Escherichia coli- Bacillus meg.pdfCapsule Staining Staphylococcus aureus- Escherichia coli- Bacillus meg.pdf
Capsule Staining Staphylococcus aureus- Escherichia coli- Bacillus meg.pdf
 
Can you site your sources for the information given please Step 1- Res.pdf
Can you site your sources for the information given please Step 1- Res.pdfCan you site your sources for the information given please Step 1- Res.pdf
Can you site your sources for the information given please Step 1- Res.pdf
 
Can you please provide a example of how these linux commands are used.pdf
Can you please provide a example of how these linux commands are used.pdfCan you please provide a example of how these linux commands are used.pdf
Can you please provide a example of how these linux commands are used.pdf
 
Capital Markets provide which of the following to a firm- (Select all.pdf
Capital Markets provide which of the following to a firm- (Select all.pdfCapital Markets provide which of the following to a firm- (Select all.pdf
Capital Markets provide which of the following to a firm- (Select all.pdf
 
Capital flight is Question 32 options- 1) 2) 3).pdf
Capital flight is Question 32 options-             1)      2)      3).pdfCapital flight is Question 32 options-             1)      2)      3).pdf
Capital flight is Question 32 options- 1) 2) 3).pdf
 
Capillaries are better for material exchange because compared to arter.pdf
Capillaries are better for material exchange because compared to arter.pdfCapillaries are better for material exchange because compared to arter.pdf
Capillaries are better for material exchange because compared to arter.pdf
 
Can this be done with an Arduino Uno- if so can I get pictures of how.pdf
Can this be done with an Arduino Uno- if so can I get pictures of how.pdfCan this be done with an Arduino Uno- if so can I get pictures of how.pdf
Can this be done with an Arduino Uno- if so can I get pictures of how.pdf
 
Can someone Please solve Question 1 part B - Thanks!.pdf
Can someone Please solve Question 1 part B -  Thanks!.pdfCan someone Please solve Question 1 part B -  Thanks!.pdf
Can someone Please solve Question 1 part B - Thanks!.pdf
 
Canada's Quota on European Cheese- In 2021- Canada imposed a quota on.pdf
Canada's Quota on European Cheese- In 2021- Canada imposed a quota on.pdfCanada's Quota on European Cheese- In 2021- Canada imposed a quota on.pdf
Canada's Quota on European Cheese- In 2021- Canada imposed a quota on.pdf
 
Charles named several programs and philosophies that are integral to t.pdf
Charles named several programs and philosophies that are integral to t.pdfCharles named several programs and philosophies that are integral to t.pdf
Charles named several programs and philosophies that are integral to t.pdf
 
Chapters 5 - 11 book is Human Resource Management in Health Care princ.pdf
Chapters 5 - 11 book is Human Resource Management in Health Care princ.pdfChapters 5 - 11 book is Human Resource Management in Health Care princ.pdf
Chapters 5 - 11 book is Human Resource Management in Health Care princ.pdf
 
Chapter Review Questions Labeling Itentifu she thene ratanovien of mur (1).pdf
Chapter Review Questions Labeling Itentifu she thene ratanovien of mur (1).pdfChapter Review Questions Labeling Itentifu she thene ratanovien of mur (1).pdf
Chapter Review Questions Labeling Itentifu she thene ratanovien of mur (1).pdf
 
Chapter 8 sample study questions What is the difference between a Lang.pdf
Chapter 8 sample study questions What is the difference between a Lang.pdfChapter 8 sample study questions What is the difference between a Lang.pdf
Chapter 8 sample study questions What is the difference between a Lang.pdf
 
Chapter 6 Define virus- viroid- virion- prion- provirus- reverse trans.pdf
Chapter 6 Define virus- viroid- virion- prion- provirus- reverse trans.pdfChapter 6 Define virus- viroid- virion- prion- provirus- reverse trans.pdf
Chapter 6 Define virus- viroid- virion- prion- provirus- reverse trans.pdf
 
Chapter 7 Discussion Key Handling This chapter discusses the importanc.pdf
Chapter 7 Discussion Key Handling This chapter discusses the importanc.pdfChapter 7 Discussion Key Handling This chapter discusses the importanc.pdf
Chapter 7 Discussion Key Handling This chapter discusses the importanc.pdf
 
Can someone pls explain the table- FOr the labelled A to E- How do you.pdf
Can someone pls explain the table- FOr the labelled A to E- How do you.pdfCan someone pls explain the table- FOr the labelled A to E- How do you.pdf
Can someone pls explain the table- FOr the labelled A to E- How do you.pdf
 
Chapter 4- Trees- Show that if any complete- balanced tree has three c.pdf
Chapter 4- Trees- Show that if any complete- balanced tree has three c.pdfChapter 4- Trees- Show that if any complete- balanced tree has three c.pdf
Chapter 4- Trees- Show that if any complete- balanced tree has three c.pdf
 

Recently uploaded

Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
beazzy04
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
Thiyagu K
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
timhan337
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
DeeptiGupta154
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
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
 
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
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
vaibhavrinwa19
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
SACHIN R KONDAGURI
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
RaedMohamed3
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
EduSkills OECD
 

Recently uploaded (20)

Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345Sha'Carri Richardson Presentation 202345
Sha'Carri Richardson Presentation 202345
 
Unit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdfUnit 8 - Information and Communication Technology (Paper I).pdf
Unit 8 - Information and Communication Technology (Paper I).pdf
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
Overview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with MechanismOverview on Edible Vaccine: Pros & Cons with Mechanism
Overview on Edible Vaccine: Pros & Cons with Mechanism
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
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
 
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
 
Acetabularia Information For Class 9 .docx
Acetabularia Information For Class 9  .docxAcetabularia Information For Class 9  .docx
Acetabularia Information For Class 9 .docx
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
 

Can someone tell me why I'm getting Java error cannot invoke add(int).pdf

  • 1. Can someone tell me why I'm getting Java error cannot invoke add(int) on array type int on the bold line? I need this method to calculate median based on file that will be input in a different method. Do no change to a main method as I need to reserve that to only have a contructor. public int Problem7(File file) throws FileNotFoundException { int[] listInt; try { Scanner scanner = new Scanner(file); while (scanner.hasNextLine()) { String value = scanner.nextLine(); listInt.add(Integer.parseInt(value)); System.out.println(value); } scanner.close(); } catch (Exception ex) { ex.printStackTrace(); } Arrays.sort(listInt); int middle = listInt.length/2; int median = 0; if (listInt.length%2 == 1) median = listInt[middle]; else median = (listInt[middle-1] + listInt[middle]) / 2; return median;
  • 2. }}