Adding different type of objects in a List (Java)?

manishks

manishks

@manishks-AZybhs • Oct 26, 2024

Is it possible? And if yes how can I access them in JSP? Can any one help me with this? 😀

Replies

Welcome, guest

Join CrazyEngineers to reply, ask questions, and participate in conversations.

CrazyEngineers powered by Jatra Community Platform

  • Vishal Sharma

    Vishal Sharma

    @vishal-pysGmK Sep 2, 2015

    manishksIs it possible? And if yes how can I access them in JSP? Can any one help me with this? 😀

    Not a fan of JSP to give you a code snippet, but yes you can do that.
    Please try to search.

  • Anoop Kumar

    Anoop Kumar

    @anoop-kumar-GDGRCn Sep 2, 2015

    List <Object> = new ArrayList <Object>;
    Problem is, if there are different type of object, how you are going to retrieve it?
    You need to know what kind of object you put at specific location. while casting back.