0% found this document useful (0 votes)
13 views1 page

ArrayListPgm Java2

Uploaded by

Saniya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views1 page

ArrayListPgm Java2

Uploaded by

Saniya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

import java.util.

*;
class Student{
int rollno;
String name;
int age;
Student (int rollno ,String name , int age )
{
this.rollno = rollno;
this.name = name;
this.age = age;
}
}
class ArrayListPgm {
public static void main (String[] args){
Student s1 = new student (101,"arun",21);
Student s2 = new student (102,"arjun",25);y
Student s3 = new student (103,"amogh",23);
ArrayList<Student> al=new ArrayList<student>();
Iterator<student> itr=.itrator();
al.add(s1);
al.add(s2);
al.add(s3);
System.out.print(al);
itr=al.iterator();
while (itr.hasnext());
{

Student student= itr. next();


System.out.println (student.rollno + " " student.name +" " student.age );
}
}
}

You might also like