The program cannot display the value which had assign to properly.The output is some weird texts.Why?
import java.util.ArrayList;
class Employeee
{
private String name,department,position;
private int idNumber;
public Employeee()
{
name = null;
position = null;
department = null;
idNumber = 0;
}
public Employeee(String n,String p,String d,int i)
{
name = n;
position = p;
department = d;
idNumber = i;
}
public void setName(String n)
{
name = n;
}
public void setPosition(String p)
{
position = p;
}
public void setDepartment(String d)
{
department = d;
}
public void setidNumber(int i)
{
idNumber = i;
}
public String getPosition()
{
return position;
}
public String getDepartment()
{
return department;
}
public String getName()
{
return name;
}
public int getidNumber()
{
return idNumber;
}
}
public class EmployeeeTest
{
public static void main(String[] args)
{
Employeee emp1 = new Employeee("Dr.Nor Sabrina","Vice President","Accounting",47899);
Employeee emp2 = new Employeee("En Ahmad","Programmer","IT",39119);
Employeee emp3 = new Employeee("Prof M Izzudin","Manager","Consultation",66666);
Employeee emp4 = new Employeee("Dr N Izzati","CEO","Elect&Etronic",34521);
Employeee emp5 = new Employeee("Dr A Rahman","Manager","PR",12321);
ArrayList ar = new ArrayList();
ar.add(new Employeee("Dr.Nor Sabrina","Vice President","Accounting",47899));
ar.add(emp2);
ar.add(emp3);
ar.add(emp4);
ar.add(emp5);
for(int i =0;i<ar.size();i++)
{System.out.println(ar.get(i));}
}
}