CH - 02
CH - 02
class Student{
int id; public static void main(String args[]){
String name; Student s1 = new Student(111,"Karan"); Student s2 =
Student(int id, String name){ new Student(222,"Aryan");
this.id = id; s1.display();
this.name = name; s2.display();
}
} }
void display(){
System.out.println(id+" "+name);
}
ArrayList uses Iterator interface to traverse the Vector uses Enumeration interface to traverse
elements. the elements. But it can use Iterator also.