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 7962413
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T05:19:52+00:00 2026-06-04T05:19:52+00:00

I recently was in an interview and during that interview I realized my programming

  • 0

I recently was in an interview and during that interview I realized my programming concepts aren’t as concrete as I thought.

I was asked, describe a time in your previous job where you used polymorphism?

After some thinking I said that we had a record class which every new record extended. So if we have a AddRecord or a RemoveRecord or any other type of record, they would extend Record. The record interface looked something like this:

public abstract Record{
  public writeLine(String line);
  public getColumn(int column);
  public setHeader(String header);
  ...
}

public AddRecord extends Record{
  public writeLine(String line){
      // do something
  }

  // etc...
}

public MakeRecord{
   Record r;
   public setRecord(Object s){
      if(s instanceof Record){
          r = s;
      }
   } 

   public void printNewRecord(){
      while(thingsToWrite){
          r.writeLine(something);
      }
   }
}

I just shorthanded it so don’t nit pick it please.

I told them this was using polymorphism because regardless of the record type, it could be wrote without knowing what type of record it was. This was valuable because we are writing files that needed to be padded correctly, either zero filled or padded with spaces etc…

If this isn’t polymorphism, please tell me how I can change my example into something that uses polymorphism.

  • 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-04T05:19:53+00:00Added an answer on June 4, 2026 at 5:19 am

    Long answer short: yes
    Polymorphism is, according to webster:a (1) : existence of a species in several forms independent of the variations of sex (2) : existence of a gene in several allelic forms (3) : existence of a molecule (as an enzyme) in several forms in a single species b : the property of crystallizing in two or more forms with distinct structure

    we are focused with definition a. this describes, in java terms, as using 1 “top” class to reference two “bottom” classes. That is shown in the above example, to the best of my knowledge.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I was recently asked in a job interview to resolve a programming puzzle that
Recently I was asked in an interview that, can an Interface be considered as
I was asked this question recently during my job interview, and I couldn't answer
I have been asked recently in a job interview to develop an algorithm that
I was asked this question in a job interview recently. I answered that I
During an interview recently, I was asked, What's dangerous about using closures when referencing
Recently I was asked this during a job interview. I was honest and said
This is an interview Question that i was asked recently: Write a C program
I was looking at interview questions and I recently came upon one that asked
This was asked in my Google interview recently and I offered an answer which

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.