60 736
Assignments Done
97,9%
Successfully Done
In April 2018

Answer to Question #50302 in Java | JSP | JSF for faraaz

Question #50302
this is my assignment: write a method called remove that accepts one ArrayList<String> parameter and one char parameter.go through the ArrayList and remove any string that begins with the character in the second parameter . the method does not need to return any values. i have posted my solution down below but for some reason there is an error.

public class test
{
public void remove(ArrayList() arInput, char c)
{
for (int i = 0; i <= arInput.length; i++)
{
ArrayList() newArray = new ArrayList();
if (c != arInput[i].substring(0,1))
{
newArray.put[arInput[i]];
}
}
System.out.println("new array is: " + newArray);
}
}
Expert's answer
Solution.
 
    public class test
    {
        public void remove(ArrayList<String> arInput, Stringc)
        {
            ArrayList<String> newArray = new ArrayList();
            for(int i = 0; i <= arInput.size(); i++)
            {
                if(c != arInput.get(i).substring(0,1))
                {
                   newArray.add(arInput.get(i));
                }
            }
                System.out.println("new array is: " + newArray);
        }
   }


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions