Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

help with inputForMethod_1_B(), thanks package code; import java.util.ArrayList;

ID: 3686188 • Letter: H

Question

help with inputForMethod_1_B(), thanks

package code;

import java.util.ArrayList;

public class Inputs {
   // Study the definition of the method
   // method_1
   // defined in the class Methods.
   // Define the following method so it returns a value which,
   // if passed as an argument to method_1,
   // causes method_1 to return the value 20.
   public ArrayList<String> inputForMethod_1_A() {
       ArrayList<String>retVal = new ArrayList<String>();
       retVal.add("hello");
       retVal.add("World");
       retVal.add("xxxxxxxxxx");
       retVal.add("");
       return retVal;
   }
  
   // Study the definition of the method
   // method_1
   // defined in the class Methods.
   // Define the following method so it returns a value which,
   // if passed as an argument to method_1,
   // causes method_1 to return the value 6.
   public ArrayList<String> inputForMethod_1_B() {
      
       return null;
   }

DInputs,javaMethods.java3 1 package code; 2 3 import java.util.ArrayList; 4 5 public class Methods 6 7ed public int method 1(ArrayList

Explanation / Answer

import java.util.ArrayList;

public class Inputs {
   // Study the definition of the method
   // method_1
   // defined in the class Methods.
   // Define the following method so it returns a value which,
   // if passed as an argument to method_1,
   // causes method_1 to return the value 20.
   public ArrayList<String> inputForMethod_1_A() {
       ArrayList<String>retVal = new ArrayList<String>();
       retVal.add("hello");
       retVal.add("World");
       retVal.add("xxxxxxxxxx");
       retVal.add("");
       return retVal;
   }

   // Study the definition of the method
   // method_1
   // defined in the class Methods.
   // Define the following method so it returns a value which,
   // if passed as an argument to method_1,
   // causes method_1 to return the value 6.
   public static ArrayList<String> inputForMethod_1_B() {
    
       ArrayList<String> list = new ArrayList<String>();
       list.add("Hi");
       list.add("Good");
       list.add("");
       return list;
   }
}