package com.demo.swain;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class ListBox {
String name,adress,city;
int rollno,age;
public static void main(String args[]){
System.out.println("Name"+" "+"adress"+" "+"city"+" "+"rollno"+" "+"age");
System.out.println("********************************************************");
ListBox obj=new ListBox();
List<ListBox> obj1=new ArrayList<ListBox>();
obj.setAdress("odisha");
obj.setAge(23);
obj.setCity("bbsr");
obj.setName("sitansu");
obj.setRollno(209);
obj1.add(obj);
obj=new ListBox();
obj.setAdress("A");
obj.setAge(21);
obj.setCity("dfsre");
obj.setName("ewrtfs");
obj.setRollno(5345);
obj1.add(obj);
obj=new ListBox();
obj.setAdress("erew");
obj.setAge(2312);
obj.setCity("rrewfwf");
obj.setName("xxvzv");
obj.setRollno(434);
obj1.add(obj);
for(ListBox data:obj1){
System.out.println(data.getAdress()+ " "+data.getAge()+" "+data.getCity()+" "+data.getRollno()+" "+data.getName());
}
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAdress() {
return adress;
}
public void setAdress(String adress) {
this.adress = adress;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public int getRollno() {
return rollno;
}
public void setRollno(int rollno) {
this.rollno = rollno;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
}
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class ListBox {
String name,adress,city;
int rollno,age;
public static void main(String args[]){
System.out.println("Name"+" "+"adress"+" "+"city"+" "+"rollno"+" "+"age");
System.out.println("********************************************************");
ListBox obj=new ListBox();
List<ListBox> obj1=new ArrayList<ListBox>();
obj.setAdress("odisha");
obj.setAge(23);
obj.setCity("bbsr");
obj.setName("sitansu");
obj.setRollno(209);
obj1.add(obj);
obj=new ListBox();
obj.setAdress("A");
obj.setAge(21);
obj.setCity("dfsre");
obj.setName("ewrtfs");
obj.setRollno(5345);
obj1.add(obj);
obj=new ListBox();
obj.setAdress("erew");
obj.setAge(2312);
obj.setCity("rrewfwf");
obj.setName("xxvzv");
obj.setRollno(434);
obj1.add(obj);
for(ListBox data:obj1){
System.out.println(data.getAdress()+ " "+data.getAge()+" "+data.getCity()+" "+data.getRollno()+" "+data.getName());
}
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getAdress() {
return adress;
}
public void setAdress(String adress) {
this.adress = adress;
}
public String getCity() {
return city;
}
public void setCity(String city) {
this.city = city;
}
public int getRollno() {
return rollno;
}
public void setRollno(int rollno) {
this.rollno = rollno;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
}
No comments:
Post a Comment