الرجوع
تسجيل الدخول

What is the purpose of this code?

Vector names = new Vector<>();
names.add("Alice");
names.add("Bob");
names.add("Charlie");
Vector filteredNames = new Vector<>();
for (int i = 0; i < names.size(); i++) {
    if (names.get(i).length() > 3) {
        filteredNames.add(names.get(i));
    }
}
System.out.println("Short names: " + filteredNames);