Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  1. albertoa

    ArrayList cast different types of objects

    Also you can use an Object's method to retrieve the class name of the object. Arraylist list= null; list.add(new MachineGun()); list.add(new Gun()); .. .. if(list.get(0).getClass().getSimpleName().equals("MachineGun")){ //here you can safely cast in the right class MachineGun...

Part and Inventory Search

Back
Top