Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a Java program that will split the following string ( the code should be able to handle any number of commas ) and store

Write a Java program that will split the following string (the code should be able to handle any number of
commas) and store the elements in an Array or Array List:
String str = "Apple, Orange, Pear, Peach";
Your code will create an array of strings: {"Apple", "Orange", "Pear", "Peach"}
Now, write a code to create a new string from the array you just created:
String str2= "Apple--Orange--Pear--Peach";
Important: You cannot use any built-in methods of the String class.
Do at home:
Use the codes you developed to read lines (comma-separated) from the file input.csv darr and write the lines in a
file called output.txt in the format of the second string above.
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Main Memory Database Systems

Authors: Frans Faerber, Alfons Kemper, Per-Åke Alfons

1st Edition

1680833243, 978-1680833249

More Books

Students also viewed these Databases questions