SlideShare a Scribd company logo
1 of 2
Download to read offline
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.pdfgopalk44
 
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.pdfpratyushraj61
 
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.pdfasenterprisestyagi
 
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.pdfRAJATCHUGH12
 
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 .pdfarshin9
 
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.pdfarpaqindia
 
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.pdfaloeplusint
 
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.docxrajahchelsey
 
UserInputHandlerjava package midterm2023 import javautil.pdf
UserInputHandlerjava package midterm2023 import javautil.pdfUserInputHandlerjava package midterm2023 import javautil.pdf
UserInputHandlerjava package midterm2023 import javautil.pdfadityknits
 
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.pdfakkhan101
 
Java interface and inheritance
Java interface and inheritanceJava interface and inheritance
Java interface and inheritanceJaromirJagr
 

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.pdfaonetelecompune
 
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.pdfaonetelecompune
 
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.pdfaonetelecompune
 
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.pdfaonetelecompune
 
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.pdfaonetelecompune
 
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.pdfaonetelecompune
 
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.pdfaonetelecompune
 
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).pdfaonetelecompune
 
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.pdfaonetelecompune
 
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.pdfaonetelecompune
 
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!.pdfaonetelecompune
 
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.pdfaonetelecompune
 
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.pdfaonetelecompune
 
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.pdfaonetelecompune
 
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).pdfaonetelecompune
 
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.pdfaonetelecompune
 
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.pdfaonetelecompune
 
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.pdfaonetelecompune
 
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.pdfaonetelecompune
 
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.pdfaonetelecompune
 

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

APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024Janet Corral
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajanpragatimahajan3
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
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
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxVishalSingh1417
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...PsychoTech Services
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 

Recently uploaded (20)

APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
social pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajansocial pharmacy d-pharm 1st year by Pragati K. Mahajan
social pharmacy d-pharm 1st year by Pragati K. Mahajan
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
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
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 

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. }}