List in Wrapper Class

List in Wrapper Class

1 (a) .Create a Wrapper class student with data members (name, age and phone)

1 (b). Create List of student wrapper class and add three student objects to the list

public class Student{
	public string name ;
	public String phone;
	public Integer age;

Test the below in Developer Console

List<Student> students = new List<Student>();
Student s1 = new Student();
s1.Name = 'Kiran'; = '123';
s1.age = 20;

Student s2 = new Student(); = 'hari'; = '456';


2 (a) Create a wrapper class Employee with data members and constructor to accept empName and salary
i. empName
ii. salary
iii. doj
iv. employee(empName,  salary)

public class Employee{
	public String empName;
	public Decimal salary;
	public Date doj;
        public Employee(String empName,Decimal salary){
		this.empName= empName;
		this.salary = salary;
		doj =;

2 (b) Create List of employee class and insert three employee records to the list

List<Employee> employees = new List<Employee>();

Employee e1 = new Employee('sam', 30000);

Employee e2 = new Employee('navya', 50000);

Employee e3 = new Employee('Pravin', 40000);