I am working on a java project and I am having a problem. I want to have the sum of two lists a and b in list c but I don't know how to do that.
I want a.add(3) +b.add(4) should be in next list c where the value should be 7
similarly for 5+2=6
1+(-4)=-3
any suggestion and help would be appreciated
Code:
import java.util.ArrayList;
import java.util.List;
public class Test {
public static void main(String[] args) {
List<Integer> a = new ArrayList<Integer>();
List<Integer> b = new ArrayList<Integer>();
List<Integer> three= new ArrayList<Integer>();
a.add(3);
a.add(5);
a.add(1);
a.add(-2);
b.add(1);
b.add(2);
b.add(-4);
b.add(3);
}
}

Simply :