This is what I've been trying:
public class Assignement2_java8 {
public static void main(String[] args) {
ArrayList<String> al = new ArrayList<String>();
al.add("infosys");
al.add("wipro");
al.add("tcs");
al.add("amazon");
al.add("microsoft");
al.add("google");
al.add("acctenture");
al.add("hcl");
al.add("flipkart");
al.add("apple");
al.forEach(n -> System.out.println(n.reverse()));
}
}
I know I can use an array of words then store it in ArrayList but I want to know why I can't use this.