Exercise 1
Modify the List class of Figure 21.3 in the textbook toinclude a method that recursively searches a linked-list for aspecified value. Ensure that the name of your methodincludes your last name. The method must return areference to the value if it is found; otherwise, it must returnnull. Use your method in a test program that creates a list ofintegers. The program must prompt the user for a value to locate inthe list.
I need the code modified in java to pull out the correct inputbelow is my code, but when ran the only out I get is \"Enterintegers(-1 to stop):\" and nothing else
PLEASE HELP
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Main {
public static T search_mylastname(List list, Tvalue, int index){//function name can be updated in all places tothe lastname if needed
 Â
if(list == null || index == list.size())
return null;
 Â
if(value.equals(list.get(index)))
return list.get(index);
 Â
return search_mylastname(list, value, index+1);
 Â
}
 Â
public static void main(String[] args) {
 Â
List list = new ArrayList<>();
 Â
System.out.println(\"Enter integers(-1 to stop): \"
     + \"2, \"
     + \"4, \"
     + \"6, \"
     + \"8, \"
     + \"10\");
int num;
Scanner sc = new Scanner(System.in);
while(true){
num = sc.nextInt();
if(num == -1)
break;
list.add(num);
}
 Â
System.out.print(\"Enter integer to search: \");
int key = sc.nextInt();
Integer res = search_mylastname(list, key, 0);
if(res == null)
System.out.println(key+\" is not in list\");
else
System.out.println(key+\" is available in list\");
}
}