Showing error in the for loop

for (String val : al) {
^
Note: Main.java uses unchecked or unsafe operations.

mport java.util.*;

public class Main {
public static ArrayList al = new ArrayList<>();

public static void main(String[] args) {
	Scanner sc = new Scanner(System.in);
	String s = sc.next();
	findsubsequences(s, "");
	// System.out.println(al);// not print arrayList
	// get string from arrayList
	for (String val : al) {
		System.out.print(val + " ");
	}
	System.out.println();

	System.out.println(findsize(al));
}

private static void findsubsequences(String s, String ans) {
	if (s.length() == 0) {
		al.add(ans);
		return;
	}
	// Not adding first character of the string
	// because the concept of subsequence either // character will present or not
	findsubsequences(s.substring(1), ans);
	// we add adding 1st character in string
	findsubsequences(s.substring(1), ans + s.charAt(0));

}

private static int findsize(ArrayList<String> al) {
	return al.size();
}

}

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.