Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8956215
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T14:44:25+00:00 2026-06-15T14:44:25+00:00

Iam writing a simple Java program for an assignment,which implements a library system using

  • 0

Iam writing a simple Java program for an assignment,which implements a library system using inheritance.I have a class named Entry and two others who extend it (book and journal).

Everything works fine.

Now i must create a class which will test the whole program.This class should use an array to store the elements (books OR journals which i want to add in the system).I don’t know how many elements i will add but i must declare an array for them (either my entry will be book,or journal).My question is:This array should be an Entry array (as i suppose) and if yes,if for example i want to add a book the extra elements that Book has where will be stored?

Thank you in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T14:44:26+00:00Added an answer on June 15, 2026 at 2:44 pm

    Yes you should add to an Entry array. You can add Book instance to the Entry array since it is extending Entry. To access the properties or methods of Book after getting it from Entry array, you have to cast it to Book.

    Entry[] entries = new Entry[5];
    entries[0] = new Book();
    Book aBook = (Book)entries[0];
    aBook.getBookTitle();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Currently I am writing a program for an introductory Java class. I have two
I have a Java Project in which I am writing a simple JUNIT test
I am writing simple parallel program in C++ using OpenMP. I am working on
I am writing a simple C program to exchange messages through named pipes on
Background I am writing a simple online judge (a code grading system) using PHP
I am writing a java program in eclipse(galileo version). The program reads simple user
I am writing a java web-application program to create a file(a simple xml file)
I am writing a program in Java in which I need to edit a
I am writing a simple Java program to send mail, but am getting errors.
I am writing a program in Java which tracks data about baseball cards. I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.