SlideShare a Scribd company logo
1 of 2
Write a program that uses the ArrayList class and populate it
with a list of your course codes, i.e MIS210, then use the
ArrayList methods described in the example in class to add,
remove, and display information about the ArrayList.
simple example of ArrayList:
package bmarina;
import java.util.ArrayList;
public class ArrayListExample {
public static void main(String[] args) {
ArrayList cityList = new ArrayList();
cityList.add("London");
cityList.add("New York");
cityList.add("Paris");
cityList.add("Toronto");
cityList.add("Hong Kong");
cityList.add("Singapore");
System.out.println("List size is " + cityList.size());
System.out.println("Is Toronto in the list? " +
cityList.contains("Toronto"));
System.out.println("The location of New York in the list is
" + cityList.indexOf("New York"));
System.out.println("Is the list empty? " +
cityList.isEmpty());
cityList.add(2, "Beijin");
System.out.println("List size is " + cityList.size());
System.out.println("The location of Beijin in the list is " +
cityList.indexOf("Beijin"));
cityList.remove("Toronto");
System.out.println("List size is " + cityList.size());
cityList.remove(0);
System.out.println("List size is " + cityList.size());
System.out.println(cityList.toString());
for (int i = cityList.size() - 1; i >= 0 ; i--) {
System.out.print(cityList.get(i) + " ");
}
System.out.println();
}
}

More Related Content

Similar to Write a program that uses the ArrayList class and populate it with a.docx

Write a method called uniqueNumbers that takes an int array as param.pdf
Write a method called uniqueNumbers that takes an int array as param.pdfWrite a method called uniqueNumbers that takes an int array as param.pdf
Write a method called uniqueNumbers that takes an int array as param.pdffashioncollection2
 
Engineering lecture ppt by venay magen
Engineering lecture ppt by venay magenEngineering lecture ppt by venay magen
Engineering lecture ppt by venay magenvenaymagen19
 
Please add-modify the following to the original code using C# 1- Delet.docx
Please add-modify the following to the original code using C# 1- Delet.docxPlease add-modify the following to the original code using C# 1- Delet.docx
Please add-modify the following to the original code using C# 1- Delet.docxStewartt0kJohnstonh
 
lec6.ppt
lec6.pptlec6.ppt
lec6.pptcawarir
 
collectionframework-141116005344-conversion-gate01.pptx
collectionframework-141116005344-conversion-gate01.pptxcollectionframework-141116005344-conversion-gate01.pptx
collectionframework-141116005344-conversion-gate01.pptxhemanth248901
 
Gauss in java
Gauss in javaGauss in java
Gauss in javabaxter89
 
Write a method countUnique that takes a List of integers as a parame.pdf
Write a method countUnique that takes a List of integers as a parame.pdfWrite a method countUnique that takes a List of integers as a parame.pdf
Write a method countUnique that takes a List of integers as a parame.pdfMALASADHNANI
 
Need to be done in C++ Please Sorted number list implementation wit.pdf
Need to be done in C++  Please   Sorted number list implementation wit.pdfNeed to be done in C++  Please   Sorted number list implementation wit.pdf
Need to be done in C++ Please Sorted number list implementation wit.pdfaathiauto
 
I need help with this code working Create another project and add yo.pdf
I need help with this code working Create another project and add yo.pdfI need help with this code working Create another project and add yo.pdf
I need help with this code working Create another project and add yo.pdffantoosh1
 
An object of class StatCalc can be used to compute several simp.pdf
 An object of class StatCalc can be used to compute several simp.pdf An object of class StatCalc can be used to compute several simp.pdf
An object of class StatCalc can be used to compute several simp.pdfaravlitraders2012
 
In this homework- you will write a program modify program you wrote in.pdf
In this homework- you will write a program modify program you wrote in.pdfIn this homework- you will write a program modify program you wrote in.pdf
In this homework- you will write a program modify program you wrote in.pdfEvanpZjSandersony
 
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
 
import java.util.ArrayList;public class ArrayListADT {   public .pdf
import java.util.ArrayList;public class ArrayListADT {   public .pdfimport java.util.ArrayList;public class ArrayListADT {   public .pdf
import java.util.ArrayList;public class ArrayListADT {   public .pdfmohammadirfan136964
 
Need to be done in C Please Sorted number list implementation with.pdf
Need to be done in C  Please   Sorted number list implementation with.pdfNeed to be done in C  Please   Sorted number list implementation with.pdf
Need to be done in C Please Sorted number list implementation with.pdfaathmaproducts
 
VIT351 Software Development VI Unit2
VIT351 Software Development VI Unit2VIT351 Software Development VI Unit2
VIT351 Software Development VI Unit2YOGESH SINGH
 
Implement the ListArray ADT-Implement the following operations.pdf
Implement the ListArray ADT-Implement the following operations.pdfImplement the ListArray ADT-Implement the following operations.pdf
Implement the ListArray ADT-Implement the following operations.pdfpetercoiffeur18
 

Similar to Write a program that uses the ArrayList class and populate it with a.docx (20)

Write a method called uniqueNumbers that takes an int array as param.pdf
Write a method called uniqueNumbers that takes an int array as param.pdfWrite a method called uniqueNumbers that takes an int array as param.pdf
Write a method called uniqueNumbers that takes an int array as param.pdf
 
Engineering lecture ppt by venay magen
Engineering lecture ppt by venay magenEngineering lecture ppt by venay magen
Engineering lecture ppt by venay magen
 
Please add-modify the following to the original code using C# 1- Delet.docx
Please add-modify the following to the original code using C# 1- Delet.docxPlease add-modify the following to the original code using C# 1- Delet.docx
Please add-modify the following to the original code using C# 1- Delet.docx
 
lec6.ppt
lec6.pptlec6.ppt
lec6.ppt
 
collectionframework-141116005344-conversion-gate01.pptx
collectionframework-141116005344-conversion-gate01.pptxcollectionframework-141116005344-conversion-gate01.pptx
collectionframework-141116005344-conversion-gate01.pptx
 
Gauss in java
Gauss in javaGauss in java
Gauss in java
 
Write a method countUnique that takes a List of integers as a parame.pdf
Write a method countUnique that takes a List of integers as a parame.pdfWrite a method countUnique that takes a List of integers as a parame.pdf
Write a method countUnique that takes a List of integers as a parame.pdf
 
Need to be done in C++ Please Sorted number list implementation wit.pdf
Need to be done in C++  Please   Sorted number list implementation wit.pdfNeed to be done in C++  Please   Sorted number list implementation wit.pdf
Need to be done in C++ Please Sorted number list implementation wit.pdf
 
I need help with this code working Create another project and add yo.pdf
I need help with this code working Create another project and add yo.pdfI need help with this code working Create another project and add yo.pdf
I need help with this code working Create another project and add yo.pdf
 
An object of class StatCalc can be used to compute several simp.pdf
 An object of class StatCalc can be used to compute several simp.pdf An object of class StatCalc can be used to compute several simp.pdf
An object of class StatCalc can be used to compute several simp.pdf
 
Basic data-structures-v.1.1
Basic data-structures-v.1.1Basic data-structures-v.1.1
Basic data-structures-v.1.1
 
In this homework- you will write a program modify program you wrote in.pdf
In this homework- you will write a program modify program you wrote in.pdfIn this homework- you will write a program modify program you wrote in.pdf
In this homework- you will write a program modify program you wrote in.pdf
 
Java and j2ee_lab-manual
Java and j2ee_lab-manualJava and j2ee_lab-manual
Java and j2ee_lab-manual
 
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
 
import java.util.ArrayList;public class ArrayListADT {   public .pdf
import java.util.ArrayList;public class ArrayListADT {   public .pdfimport java.util.ArrayList;public class ArrayListADT {   public .pdf
import java.util.ArrayList;public class ArrayListADT {   public .pdf
 
Need to be done in C Please Sorted number list implementation with.pdf
Need to be done in C  Please   Sorted number list implementation with.pdfNeed to be done in C  Please   Sorted number list implementation with.pdf
Need to be done in C Please Sorted number list implementation with.pdf
 
VIT351 Software Development VI Unit2
VIT351 Software Development VI Unit2VIT351 Software Development VI Unit2
VIT351 Software Development VI Unit2
 
Second chapter-java
Second chapter-javaSecond chapter-java
Second chapter-java
 
Lec2
Lec2Lec2
Lec2
 
Implement the ListArray ADT-Implement the following operations.pdf
Implement the ListArray ADT-Implement the following operations.pdfImplement the ListArray ADT-Implement the following operations.pdf
Implement the ListArray ADT-Implement the following operations.pdf
 

More from alexandernmeredith30

Write a Python program to convert temperature from Celsius to Fahren.docx
Write a Python program to convert temperature from Celsius to Fahren.docxWrite a Python program to convert temperature from Celsius to Fahren.docx
Write a Python program to convert temperature from Celsius to Fahren.docxalexandernmeredith30
 
Write a reading reflection notes of chapter one up to chapter 6 in.docx
Write a reading reflection notes of chapter one up to chapter 6 in.docxWrite a reading reflection notes of chapter one up to chapter 6 in.docx
Write a reading reflection notes of chapter one up to chapter 6 in.docxalexandernmeredith30
 
Write a Reaction Paper- Assigned 4-5pages.What are the human.docx
Write a Reaction Paper- Assigned 4-5pages.What are the human.docxWrite a Reaction Paper- Assigned 4-5pages.What are the human.docx
Write a Reaction Paper- Assigned 4-5pages.What are the human.docxalexandernmeredith30
 
Write a qualitative research paper with the following topic The He.docx
Write a qualitative research paper with the following topic The He.docxWrite a qualitative research paper with the following topic The He.docx
Write a qualitative research paper with the following topic The He.docxalexandernmeredith30
 
Write a Python program that reads IP addresses from an input fil.docx
Write a Python program that reads IP addresses from an input fil.docxWrite a Python program that reads IP addresses from an input fil.docx
Write a Python program that reads IP addresses from an input fil.docxalexandernmeredith30
 
Write a Python program to hold information on a courseProg.docx
Write a Python program to hold information on a courseProg.docxWrite a Python program to hold information on a courseProg.docx
Write a Python program to hold information on a courseProg.docxalexandernmeredith30
 
Write a proposal to a local government official to propose a cha.docx
Write a proposal to a local government official to propose a cha.docxWrite a proposal to a local government official to propose a cha.docx
Write a proposal to a local government official to propose a cha.docxalexandernmeredith30
 
Write a proposal of 200 words. In this proposal, explain your future.docx
Write a proposal of 200 words. In this proposal, explain your future.docxWrite a proposal of 200 words. In this proposal, explain your future.docx
Write a proposal of 200 words. In this proposal, explain your future.docxalexandernmeredith30
 
Write a proposal about indian songs Zindagi Bhar Nahin Bhulegi” In.docx
Write a proposal about indian songs Zindagi Bhar Nahin Bhulegi” In.docxWrite a proposal about indian songs Zindagi Bhar Nahin Bhulegi” In.docx
Write a proposal about indian songs Zindagi Bhar Nahin Bhulegi” In.docxalexandernmeredith30
 
Write a proposal according to the promptinstructions on the attac.docx
Write a proposal according to the promptinstructions on the attac.docxWrite a proposal according to the promptinstructions on the attac.docx
Write a proposal according to the promptinstructions on the attac.docxalexandernmeredith30
 
Write a Project Risk Management Paper. Your Essay should cover the f.docx
Write a Project Risk Management Paper. Your Essay should cover the f.docxWrite a Project Risk Management Paper. Your Essay should cover the f.docx
Write a Project Risk Management Paper. Your Essay should cover the f.docxalexandernmeredith30
 
Write a program with a class called Employee for 5 employees with a .docx
Write a program with a class called Employee for 5 employees with a .docxWrite a program with a class called Employee for 5 employees with a .docx
Write a program with a class called Employee for 5 employees with a .docxalexandernmeredith30
 
Write a program that gets two inputs an integer and a character. Use.docx
Write a program that gets two inputs an integer and a character. Use.docxWrite a program that gets two inputs an integer and a character. Use.docx
Write a program that gets two inputs an integer and a character. Use.docxalexandernmeredith30
 
Write a press release with media list.Introduction paragraph sta.docx
Write a press release with media list.Introduction paragraph sta.docxWrite a press release with media list.Introduction paragraph sta.docx
Write a press release with media list.Introduction paragraph sta.docxalexandernmeredith30
 
Write a Process  Paragraph  Write at least  six steps.  .docx
Write a Process  Paragraph  Write at least  six steps.  .docxWrite a Process  Paragraph  Write at least  six steps.  .docx
Write a Process  Paragraph  Write at least  six steps.  .docxalexandernmeredith30
 
write a post that agrees OR disagrees with the assertion. Cite.docx
write a post that agrees OR disagrees with the assertion. Cite.docxwrite a post that agrees OR disagrees with the assertion. Cite.docx
write a post that agrees OR disagrees with the assertion. Cite.docxalexandernmeredith30
 
Write a Process  Paragraph  Write at least  six steps.  Reme.docx
Write a Process  Paragraph  Write at least  six steps.  Reme.docxWrite a Process  Paragraph  Write at least  six steps.  Reme.docx
Write a Process  Paragraph  Write at least  six steps.  Reme.docxalexandernmeredith30
 
Write a post in response to the following prompt.Pick an institu.docx
Write a post in response to the following prompt.Pick an institu.docxWrite a post in response to the following prompt.Pick an institu.docx
Write a post in response to the following prompt.Pick an institu.docxalexandernmeredith30
 
write a position paper of at least 350 words. You must use proper ci.docx
write a position paper of at least 350 words. You must use proper ci.docxwrite a position paper of at least 350 words. You must use proper ci.docx
write a position paper of at least 350 words. You must use proper ci.docxalexandernmeredith30
 
Write a policy report on one of the highly debated areas in Public E.docx
Write a policy report on one of the highly debated areas in Public E.docxWrite a policy report on one of the highly debated areas in Public E.docx
Write a policy report on one of the highly debated areas in Public E.docxalexandernmeredith30
 

More from alexandernmeredith30 (20)

Write a Python program to convert temperature from Celsius to Fahren.docx
Write a Python program to convert temperature from Celsius to Fahren.docxWrite a Python program to convert temperature from Celsius to Fahren.docx
Write a Python program to convert temperature from Celsius to Fahren.docx
 
Write a reading reflection notes of chapter one up to chapter 6 in.docx
Write a reading reflection notes of chapter one up to chapter 6 in.docxWrite a reading reflection notes of chapter one up to chapter 6 in.docx
Write a reading reflection notes of chapter one up to chapter 6 in.docx
 
Write a Reaction Paper- Assigned 4-5pages.What are the human.docx
Write a Reaction Paper- Assigned 4-5pages.What are the human.docxWrite a Reaction Paper- Assigned 4-5pages.What are the human.docx
Write a Reaction Paper- Assigned 4-5pages.What are the human.docx
 
Write a qualitative research paper with the following topic The He.docx
Write a qualitative research paper with the following topic The He.docxWrite a qualitative research paper with the following topic The He.docx
Write a qualitative research paper with the following topic The He.docx
 
Write a Python program that reads IP addresses from an input fil.docx
Write a Python program that reads IP addresses from an input fil.docxWrite a Python program that reads IP addresses from an input fil.docx
Write a Python program that reads IP addresses from an input fil.docx
 
Write a Python program to hold information on a courseProg.docx
Write a Python program to hold information on a courseProg.docxWrite a Python program to hold information on a courseProg.docx
Write a Python program to hold information on a courseProg.docx
 
Write a proposal to a local government official to propose a cha.docx
Write a proposal to a local government official to propose a cha.docxWrite a proposal to a local government official to propose a cha.docx
Write a proposal to a local government official to propose a cha.docx
 
Write a proposal of 200 words. In this proposal, explain your future.docx
Write a proposal of 200 words. In this proposal, explain your future.docxWrite a proposal of 200 words. In this proposal, explain your future.docx
Write a proposal of 200 words. In this proposal, explain your future.docx
 
Write a proposal about indian songs Zindagi Bhar Nahin Bhulegi” In.docx
Write a proposal about indian songs Zindagi Bhar Nahin Bhulegi” In.docxWrite a proposal about indian songs Zindagi Bhar Nahin Bhulegi” In.docx
Write a proposal about indian songs Zindagi Bhar Nahin Bhulegi” In.docx
 
Write a proposal according to the promptinstructions on the attac.docx
Write a proposal according to the promptinstructions on the attac.docxWrite a proposal according to the promptinstructions on the attac.docx
Write a proposal according to the promptinstructions on the attac.docx
 
Write a Project Risk Management Paper. Your Essay should cover the f.docx
Write a Project Risk Management Paper. Your Essay should cover the f.docxWrite a Project Risk Management Paper. Your Essay should cover the f.docx
Write a Project Risk Management Paper. Your Essay should cover the f.docx
 
Write a program with a class called Employee for 5 employees with a .docx
Write a program with a class called Employee for 5 employees with a .docxWrite a program with a class called Employee for 5 employees with a .docx
Write a program with a class called Employee for 5 employees with a .docx
 
Write a program that gets two inputs an integer and a character. Use.docx
Write a program that gets two inputs an integer and a character. Use.docxWrite a program that gets two inputs an integer and a character. Use.docx
Write a program that gets two inputs an integer and a character. Use.docx
 
Write a press release with media list.Introduction paragraph sta.docx
Write a press release with media list.Introduction paragraph sta.docxWrite a press release with media list.Introduction paragraph sta.docx
Write a press release with media list.Introduction paragraph sta.docx
 
Write a Process  Paragraph  Write at least  six steps.  .docx
Write a Process  Paragraph  Write at least  six steps.  .docxWrite a Process  Paragraph  Write at least  six steps.  .docx
Write a Process  Paragraph  Write at least  six steps.  .docx
 
write a post that agrees OR disagrees with the assertion. Cite.docx
write a post that agrees OR disagrees with the assertion. Cite.docxwrite a post that agrees OR disagrees with the assertion. Cite.docx
write a post that agrees OR disagrees with the assertion. Cite.docx
 
Write a Process  Paragraph  Write at least  six steps.  Reme.docx
Write a Process  Paragraph  Write at least  six steps.  Reme.docxWrite a Process  Paragraph  Write at least  six steps.  Reme.docx
Write a Process  Paragraph  Write at least  six steps.  Reme.docx
 
Write a post in response to the following prompt.Pick an institu.docx
Write a post in response to the following prompt.Pick an institu.docxWrite a post in response to the following prompt.Pick an institu.docx
Write a post in response to the following prompt.Pick an institu.docx
 
write a position paper of at least 350 words. You must use proper ci.docx
write a position paper of at least 350 words. You must use proper ci.docxwrite a position paper of at least 350 words. You must use proper ci.docx
write a position paper of at least 350 words. You must use proper ci.docx
 
Write a policy report on one of the highly debated areas in Public E.docx
Write a policy report on one of the highly debated areas in Public E.docxWrite a policy report on one of the highly debated areas in Public E.docx
Write a policy report on one of the highly debated areas in Public E.docx
 

Recently uploaded

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_.pdfSherif Taha
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Jisc
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docxPoojaSen20
 
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.docxRamakrishna Reddy Bijjam
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701bronxfugly43
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhikauryashika82
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxcallscotland1987
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxVishalSingh1417
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfNirmal Dwivedi
 
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
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
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).pptxdhanalakshmis0310
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
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)

Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
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
 
Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)Accessible Digital Futures project (20/03/2024)
Accessible Digital Futures project (20/03/2024)
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
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
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Dyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptxDyslexia AI Workshop for Slideshare.pptx
Dyslexia AI Workshop for Slideshare.pptx
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.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...
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
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.
 
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
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 

Write a program that uses the ArrayList class and populate it with a.docx

  • 1. Write a program that uses the ArrayList class and populate it with a list of your course codes, i.e MIS210, then use the ArrayList methods described in the example in class to add, remove, and display information about the ArrayList. simple example of ArrayList: package bmarina; import java.util.ArrayList; public class ArrayListExample { public static void main(String[] args) { ArrayList cityList = new ArrayList(); cityList.add("London"); cityList.add("New York"); cityList.add("Paris"); cityList.add("Toronto"); cityList.add("Hong Kong"); cityList.add("Singapore"); System.out.println("List size is " + cityList.size()); System.out.println("Is Toronto in the list? " + cityList.contains("Toronto")); System.out.println("The location of New York in the list is " + cityList.indexOf("New York")); System.out.println("Is the list empty? " + cityList.isEmpty()); cityList.add(2, "Beijin"); System.out.println("List size is " + cityList.size()); System.out.println("The location of Beijin in the list is " + cityList.indexOf("Beijin")); cityList.remove("Toronto"); System.out.println("List size is " + cityList.size()); cityList.remove(0); System.out.println("List size is " + cityList.size()); System.out.println(cityList.toString()); for (int i = cityList.size() - 1; i >= 0 ; i--) {
  • 2. System.out.print(cityList.get(i) + " "); } System.out.println(); } }