SlideShare une entreprise Scribd logo
1  sur  1
Télécharger pour lire hors ligne
im trying to add input to its respective arraylist and my ouput is like the picute shown below, i
only need the output to print the third line, please help me solve this in the simpliest way in java
10 public static Arraylistestring>names = new ArrayListeString >(); public static void
main(String[] args) & try { FileReader input = new FileReader ("Input, txt"); BufferedReader
sb = new BufferedReader ( input); String line; while ((iine=sb, readLine ())!= null ) { //String
nextline = infile.nextLine(); String [l] data= line.split(","); String nam = data [0]; names.add
(nam): System.out.print ln (names); 3 catch (FileNotFoundException e) {
System.out.println("File does not exist:"); } catch (Exception e) { e.printstackTrace(); } }. 3 8.
Problems@Javadoc Console gI Terminal B Coverage & Breakpoints Lerminateds LabProgram
(27) [Java Application] /Users/fionaberbiu/p2/pool/plugins/org.eclipse.justi.openjdk hotspot.jre
full ma [Names] [Names, Enma] [Names, Emma, Era]

Contenu connexe

Similaire à im trying to add input to its respective arraylist and my ouput is l.pdf

PYTHONOr else the work is fine only. Lot to learn buddy.... Improve your basi...
PYTHONOr else the work is fine only. Lot to learn buddy.... Improve your basi...PYTHONOr else the work is fine only. Lot to learn buddy.... Improve your basi...
PYTHONOr else the work is fine only. Lot to learn buddy.... Improve your basi...
Yashpatel821746
 
Please help me with a UML class diagram for the following code im.pdf
Please help me with a UML class diagram for the following code im.pdfPlease help me with a UML class diagram for the following code im.pdf
Please help me with a UML class diagram for the following code im.pdf
aioils
 
Write a java class LIST that outputsmainpublic class Ass.pdf
Write a java class LIST that outputsmainpublic class Ass.pdfWrite a java class LIST that outputsmainpublic class Ass.pdf
Write a java class LIST that outputsmainpublic class Ass.pdf
ebrahimbadushata00
 
C programming. Answer question only in C code In the eighth part, yo.pdf
C programming. Answer question only in C code In the eighth part, yo.pdfC programming. Answer question only in C code In the eighth part, yo.pdf
C programming. Answer question only in C code In the eighth part, yo.pdf
mohammedfootwear
 

Similaire à im trying to add input to its respective arraylist and my ouput is l.pdf (15)

8799.pdfOr else the work is fine only. Lot to learn buddy.... Improve your ba...
8799.pdfOr else the work is fine only. Lot to learn buddy.... Improve your ba...8799.pdfOr else the work is fine only. Lot to learn buddy.... Improve your ba...
8799.pdfOr else the work is fine only. Lot to learn buddy.... Improve your ba...
 
Or else the work is fine only. Lot to learn buddy.... Improve your basics in ...
Or else the work is fine only. Lot to learn buddy.... Improve your basics in ...Or else the work is fine only. Lot to learn buddy.... Improve your basics in ...
Or else the work is fine only. Lot to learn buddy.... Improve your basics in ...
 
PYTHONOr else the work is fine only. Lot to learn buddy.... Improve your basi...
PYTHONOr else the work is fine only. Lot to learn buddy.... Improve your basi...PYTHONOr else the work is fine only. Lot to learn buddy.... Improve your basi...
PYTHONOr else the work is fine only. Lot to learn buddy.... Improve your basi...
 
Please help me with a UML class diagram for the following code im.pdf
Please help me with a UML class diagram for the following code im.pdfPlease help me with a UML class diagram for the following code im.pdf
Please help me with a UML class diagram for the following code im.pdf
 
Basic data-structures-v.1.1
Basic data-structures-v.1.1Basic data-structures-v.1.1
Basic data-structures-v.1.1
 
iRODS Rule Language Cheat Sheet
iRODS Rule Language Cheat SheetiRODS Rule Language Cheat Sheet
iRODS Rule Language Cheat Sheet
 
Java Week4(C) Notepad
Java Week4(C)   NotepadJava Week4(C)   Notepad
Java Week4(C) Notepad
 
Python Lecture 8
Python Lecture 8Python Lecture 8
Python Lecture 8
 
Write a java class LIST that outputsmainpublic class Ass.pdf
Write a java class LIST that outputsmainpublic class Ass.pdfWrite a java class LIST that outputsmainpublic class Ass.pdf
Write a java class LIST that outputsmainpublic class Ass.pdf
 
Array list
Array listArray list
Array list
 
Data Management in Python
Data Management in PythonData Management in Python
Data Management in Python
 
JavaOne 2016 - Learn Lambda and functional programming
JavaOne 2016 - Learn Lambda and functional programmingJavaOne 2016 - Learn Lambda and functional programming
JavaOne 2016 - Learn Lambda and functional programming
 
C programming. Answer question only in C code In the eighth part, yo.pdf
C programming. Answer question only in C code In the eighth part, yo.pdfC programming. Answer question only in C code In the eighth part, yo.pdf
C programming. Answer question only in C code In the eighth part, yo.pdf
 
C Programming Unit-3
C Programming Unit-3C Programming Unit-3
C Programming Unit-3
 
The Ring programming language version 1.7 book - Part 26 of 196
The Ring programming language version 1.7 book - Part 26 of 196The Ring programming language version 1.7 book - Part 26 of 196
The Ring programming language version 1.7 book - Part 26 of 196
 

Plus de manojmozy

IDEO, Amerika Birleik Devletlerindeki en b�y�k ve en etkili tasarm .pdf
IDEO, Amerika Birleik Devletlerindeki en b�y�k ve en etkili tasarm .pdfIDEO, Amerika Birleik Devletlerindeki en b�y�k ve en etkili tasarm .pdf
IDEO, Amerika Birleik Devletlerindeki en b�y�k ve en etkili tasarm .pdf
manojmozy
 
I. Assessment(s) DescriptionFor this exercise, students are supp.pdf
I. Assessment(s) DescriptionFor this exercise, students are supp.pdfI. Assessment(s) DescriptionFor this exercise, students are supp.pdf
I. Assessment(s) DescriptionFor this exercise, students are supp.pdf
manojmozy
 

Plus de manojmozy (20)

IDENTIFY AND DISCUSS ONE LOCAL PROJECT THAT USED PROJECT FINANCE OR .pdf
IDENTIFY AND DISCUSS ONE LOCAL PROJECT THAT USED PROJECT FINANCE OR .pdfIDENTIFY AND DISCUSS ONE LOCAL PROJECT THAT USED PROJECT FINANCE OR .pdf
IDENTIFY AND DISCUSS ONE LOCAL PROJECT THAT USED PROJECT FINANCE OR .pdf
 
If we wanted to use the AWS CLI outside of AWS (on our local PCs) wh.pdf
If we wanted to use the AWS CLI outside of AWS (on our local PCs) wh.pdfIf we wanted to use the AWS CLI outside of AWS (on our local PCs) wh.pdf
If we wanted to use the AWS CLI outside of AWS (on our local PCs) wh.pdf
 
Identifique los cinco principales pa�ses receptores de IED de EE. UU.pdf
Identifique los cinco principales pa�ses receptores de IED de EE. UU.pdfIdentifique los cinco principales pa�ses receptores de IED de EE. UU.pdf
Identifique los cinco principales pa�ses receptores de IED de EE. UU.pdf
 
If X is a random variable with mean 10 and standard deviation 5, whi.pdf
If X is a random variable with mean 10 and standard deviation 5, whi.pdfIf X is a random variable with mean 10 and standard deviation 5, whi.pdf
If X is a random variable with mean 10 and standard deviation 5, whi.pdf
 
Identifique la variable de control para la carga de aerosoles atmosf�r.pdf
Identifique la variable de control para la carga de aerosoles atmosf�r.pdfIdentifique la variable de control para la carga de aerosoles atmosf�r.pdf
Identifique la variable de control para la carga de aerosoles atmosf�r.pdf
 
identifying customer needs.step1 Gather raw datastep 2 Interpret.pdf
identifying customer needs.step1 Gather raw datastep 2 Interpret.pdfidentifying customer needs.step1 Gather raw datastep 2 Interpret.pdf
identifying customer needs.step1 Gather raw datastep 2 Interpret.pdf
 
If CO2 is the acceptor in anaerobic chemolithotrophy, the donor coul.pdf
If CO2 is the acceptor in anaerobic chemolithotrophy, the donor coul.pdfIf CO2 is the acceptor in anaerobic chemolithotrophy, the donor coul.pdf
If CO2 is the acceptor in anaerobic chemolithotrophy, the donor coul.pdf
 
Identify a routine task that you might need to communicate in an off.pdf
Identify a routine task that you might need to communicate in an off.pdfIdentify a routine task that you might need to communicate in an off.pdf
Identify a routine task that you might need to communicate in an off.pdf
 
If a coefficient B is estimated to be very close to zero (e.g., 0.00.pdf
If a coefficient B is estimated to be very close to zero (e.g., 0.00.pdfIf a coefficient B is estimated to be very close to zero (e.g., 0.00.pdf
If a coefficient B is estimated to be very close to zero (e.g., 0.00.pdf
 
i. If a product has nonuniform inputs, is WIP generally divided betw.pdf
i. If a product has nonuniform inputs, is WIP generally divided betw.pdfi. If a product has nonuniform inputs, is WIP generally divided betw.pdf
i. If a product has nonuniform inputs, is WIP generally divided betw.pdf
 
identify and compare three different mobile device management (MDM) .pdf
identify and compare three different mobile device management (MDM) .pdfidentify and compare three different mobile device management (MDM) .pdf
identify and compare three different mobile device management (MDM) .pdf
 
IBM�s Stretch Project. 2500 words1. Title Page2.Introduction3..pdf
IBM�s Stretch Project. 2500 words1. Title Page2.Introduction3..pdfIBM�s Stretch Project. 2500 words1. Title Page2.Introduction3..pdf
IBM�s Stretch Project. 2500 words1. Title Page2.Introduction3..pdf
 
i. Define Property, Plant and Equipment as stipulated by IAS 16 (3 .pdf
i. Define Property, Plant and Equipment as stipulated by IAS 16 (3 .pdfi. Define Property, Plant and Equipment as stipulated by IAS 16 (3 .pdf
i. Define Property, Plant and Equipment as stipulated by IAS 16 (3 .pdf
 
IDEO, Amerika Birleik Devletlerindeki en b�y�k ve en etkili tasarm .pdf
IDEO, Amerika Birleik Devletlerindeki en b�y�k ve en etkili tasarm .pdfIDEO, Amerika Birleik Devletlerindeki en b�y�k ve en etkili tasarm .pdf
IDEO, Amerika Birleik Devletlerindeki en b�y�k ve en etkili tasarm .pdf
 
Identify and explain two (2) examples of collaborative care that cou.pdf
Identify and explain two (2) examples of collaborative care that cou.pdfIdentify and explain two (2) examples of collaborative care that cou.pdf
Identify and explain two (2) examples of collaborative care that cou.pdf
 
I. Assessment(s) DescriptionFor this exercise, students are supp.pdf
I. Assessment(s) DescriptionFor this exercise, students are supp.pdfI. Assessment(s) DescriptionFor this exercise, students are supp.pdf
I. Assessment(s) DescriptionFor this exercise, students are supp.pdf
 
If the fixed costs are NOK 50,000 and the variable cost can be expre.pdf
If the fixed costs are NOK 50,000 and the variable cost can be expre.pdfIf the fixed costs are NOK 50,000 and the variable cost can be expre.pdf
If the fixed costs are NOK 50,000 and the variable cost can be expre.pdf
 
If an individual shopping for groceries opens a bottle of water from.pdf
If an individual shopping for groceries opens a bottle of water from.pdfIf an individual shopping for groceries opens a bottle of water from.pdf
If an individual shopping for groceries opens a bottle of water from.pdf
 
Identify at least eight (8) accounting software. 2. Your list must i.pdf
Identify at least eight (8) accounting software. 2. Your list must i.pdfIdentify at least eight (8) accounting software. 2. Your list must i.pdf
Identify at least eight (8) accounting software. 2. Your list must i.pdf
 
Identify the FALSE statement. Radiometric dating1. of metamorphic .pdf
Identify the FALSE statement. Radiometric dating1. of metamorphic .pdfIdentify the FALSE statement. Radiometric dating1. of metamorphic .pdf
Identify the FALSE statement. Radiometric dating1. of metamorphic .pdf
 

Dernier

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
negromaestrong
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 

Dernier (20)

Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
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.
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.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
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Magic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptxMagic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptx
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
SOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning PresentationSOC 101 Demonstration of Learning Presentation
SOC 101 Demonstration of Learning Presentation
 

im trying to add input to its respective arraylist and my ouput is l.pdf

  • 1. im trying to add input to its respective arraylist and my ouput is like the picute shown below, i only need the output to print the third line, please help me solve this in the simpliest way in java 10 public static Arraylistestring>names = new ArrayListeString >(); public static void main(String[] args) & try { FileReader input = new FileReader ("Input, txt"); BufferedReader sb = new BufferedReader ( input); String line; while ((iine=sb, readLine ())!= null ) { //String nextline = infile.nextLine(); String [l] data= line.split(","); String nam = data [0]; names.add (nam): System.out.print ln (names); 3 catch (FileNotFoundException e) { System.out.println("File does not exist:"); } catch (Exception e) { e.printstackTrace(); } }. 3 8. Problems@Javadoc Console gI Terminal B Coverage & Breakpoints Lerminateds LabProgram (27) [Java Application] /Users/fionaberbiu/p2/pool/plugins/org.eclipse.justi.openjdk hotspot.jre full ma [Names] [Names, Enma] [Names, Emma, Era]