this pic is methods , please help with the inputs.(I have copied the code) packa
ID: 3686730 • Letter: T
Question
this pic is methods , please help with the inputs.(I have copied the code)
package code;
import java.util.ArrayList;
public class Inputs {
// Study the definition of the method
// method_5
// defined in the class Methods.
// Define the following method so it returns a value which,
// if passed as an argument to method_5,
// causes method_5 to return the value 6.
public ArrayList<String> inputForMethod_5() {
return null;
}
// Study the definition of the methods
// method_1 and method_5
// defined in the class Methods.
// Define the following method so it returns a value which,
// if passed as an argument to both method_1 and method_5,
// causes both to return the same value.
public ArrayList<String> inputForMethod_1_and_method_5() {
return null;
}
Explanation / Answer
public ArrayList inputForMethod_5() { ArrayList input = new ArrayList(); input.add("a"); input.add("bb"); input.add("ccc"); ArrayList output = new ArrayList(); output.add(new Method().method_5(input)); return output; } // Study the definition of the methods // method_1 and method_5 // defined in the class Methods. // Define the following method so it returns a value which, // if passed as an argument to both method_1 and method_5, // causes both to return the same value. public ArrayList inputForMethod_1_and_method_5() { ArrayList input = new ArrayList(); input.add("a"); ArrayList output = new ArrayList(); output.add(new Method().method_1(input)); output.add(new Method().method_5(input)); return output; }Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.