Click here to Skip to main content
15,564,389 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Create a collection of type Article and fill it with objects from the classes Article  and PublishedArticle 

What I have tried:

I tried with List, but there recognize only object with Article class
Updated 11-Dec-21 4:30am

1 solution

Since you have not shown the code that you tried it is difficult to make too many suggestions. One obvious one is that the PublishedArticle class should be a subclass of Article. See Classes (The Java™ Tutorials > Learning the Java Language > Classes and Objects)[^] for further help.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900