import java.util.ArrayList;
public class Main {
public static void main(String[] args) {
String s = "abCD";
for (char c : s.toCharArray()) {
if (Character.isLowerCase(c)) {
System.out.println(Character.toUpperCase(c));
} else {
System.out.println(Character.toLowerCase(c));
}
}
String test = "abcd";
char[] chars = test.toCharArray();
ArrayList<Character> list = new ArrayList<>();
for (char c : s.toCharArray()) {
for (char aChar : chars) {
if (c == aChar) {
list.add(c);
}
}
}
System.out.println(list);
}
}望采纳!