Answered step by step
Verified Expert Solution
Link Copied!

Question

00
1 Approved Answer

It does not say what the args passing in command line. 1. Use NetBeans IDE to do the following a. Start NetBeans. b. Please create

image text in transcribed

image text in transcribed

It does not say what the args passing in command line.

1. Use NetBeans IDE to do the following a. Start NetBeans. b. Please create a new project in a folder in your H: drive or your own flash drive and name your new project as: COSC241 pour section number grour username> c. Under the above new created project, please add 4 packages under the Source Packages named exactly as: collection, lab, project, main. d. In the lab package create Labl class. In Labl class you will create a class method called test. In the test method do the following first: ArrayList arraylist = new ArrayList(); int primitiveInt = 241; Integer wrapperInt = 101; String str = ""; arraylist.add (primitiveInt); arraylist.add (wrapperInt); arraylist.add(str); arraylist.add(2, 2202); System.out.println("The elements of arraylist: " + arraylist); System.out.println("The size of arraylist is: " + arraylist.size()); System.out.println("The elements at position 2 19: " + arraylist.get (2)); System.out.println("The first element of arraylist 19:" + arraylist.get (0)); System.out.println("The last element of arraylist 19:" + arraylist.get (arraylist.size()-1)); arraylist.remove (1); System.out.println("The elements of arraylist: " + arraylist); System.out.println("The size of arraylist is: " + arraylist.size()); System.out.println("The elements at position 2 19" + arraylist.get (2)); System.out.println("The first element of arraylist is: " + arraylist.get (0)); System.out.println("The last element of arraylist is: " + arraylist.get(arraylist.size()-1)); Note: Please type in above lines by yourself and think about why it work this way, and add appropriate import statements. e. Then clear the arraylist and convert the received command line arguments (pass to this test method as a parameter) into integers and insert them into the arraylist and print out all the elements of the arraylist; f. Remove all the elements at the odd indices about half of the elements) of the arraylist and print out all the elements left in the arraylist, g. Inside the main package, please create a new class named: Main h. Please create a static void main method inside the Main class. i. In the main method of the Main class pass the command line arguments to the test method of the Labl class: Labi. test (args); j. Save your files, test the above program, and debug if needed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions