aspose file tools*
The moose likes Beginning Java and the fly likes write a method to remove emp object based on  last name from the arraylist? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "write a method to remove emp object based on  last name from the arraylist?" Watch "write a method to remove emp object based on  last name from the arraylist?" New topic
Author

write a method to remove emp object based on last name from the arraylist?

seshagiri bollineni
Greenhorn

Joined: Mar 27, 2009
Posts: 3
Q3. Assume that an employee class is defined as given below.



Public class Employee{

String fristName;

String lastName;

Double salary;

}

Use the 'generics' feature of Array list (that is the array list can contain only objects of type Employee). Please write a removeEmployee method which has the signature of taking the generic ArrayList and the lastName attribute. The removeEmployee method needs to be remove all the employees from the array list matching the last name.

Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19718
    
  20

What have you tried so far? Have you looked at the ArrayList API?


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39380
    
  28
Welcome to JavaRanch

As you know we expect users to do their assignments, so we cannot tell you an answer. We shall however be only to happy to help if you show what you have achieved so far.
That is actually quite easy: 10 lines including { and } lines.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: write a method to remove emp object based on last name from the arraylist?