Sunday, December 10, 2006

ok finally studied finsh data structures for the second time... i added some stuffs into my Human RAM like what are the methods used in linkedlIst and arrayList.. incase they asked tmr in section B and also the codes for the department incase they give the output and ask us to write the codes out... it goes like this
OUTPUT GIVEN:Patrick 9123333,John 82323223
..this isthe class file
public class Employee{
private String name;
private int phoneNo;
public Employee(String name, int phoneNo){
this.name=name;
this.phoneNo=phoneNo;
}
public String toString()
{
return name+","+phoneo;
}


mAIN fILE

public class Organisation{
public static void main(String args[])
{
LinkedList department=new LinkedList;
Employee employee;
employee=new Employee("John" ,82323223);
department=addFirst(employee);
employee=new Employee("Patrick",91233333);
department=addFirst(employee);
employee=new Employee("Mary" 123333)
/* to remove Mary from the list*/
department=removeFirst(employee);
for(int i=0;i {
employee=department.get(i);
System.out.println(employee);
}
}


im just practising see how much i can rmb.. ahaha no harm...

No comments: