---
title: "Meaning & Key Takeaway of: For example, consider a stack (which is a…"
description: "\"“For example, consider a stack (which is a first-in, last-out list). You might have a program that requires three different types of stacks. One stack ..."
image: "https://sms4smile.com/quotes/i/e3e/herbert-schildt-177770_different-types_for-example-consider-a-stack-which-is-a_2226549.jpg"
---

#  For example, consider a stack (which is a first-in…

![“For example, consider a stack (which is a first-in, last-out list). You might have a program that requires three different types of stacks. One stack is used for integer values, one for floating-point values, and one for characters. In this case, the algorithm that implements each stack is the…” quote by Herbert Schildt](https://sms4smile.com/quotes/i/e3e/herbert-schildt-177770_different-types_for-example-consider-a-stack-which-is-a_2226549.jpg)   [Download](https://sms4smile.com/quotes/i/e3e/herbert-schildt-177770_different-types_for-example-consider-a-stack-which-is-a_2226549.jpg) [Open image](https://sms4smile.com/quotes/i/e3e/herbert-schildt-177770_different-types_for-example-consider-a-stack-which-is-a_2226549.jpg)

> ““For example, consider a stack (which is a first-in, last-out list). You might have a program that requires three different types of stacks. One stack is used for integer values, one for floating-point values, and one for characters. In this case, the algorithm that implements each stack is the same, even though the data being stored differs. In a non-object-oriented language, you would be required to create three different sets of stack routines, with each set using different names. However, because of polymorphism, in Java you can create one general set of stack routines that works for all three specific situations. This way, once you know how to use one stack, you can use them all. More generally, the concept of polymorphism is often expressed by the phrase “one interface, multiple methods.” This means that it is possible to design a generic interface to a group of related activities. Polymorphism helps reduce complexity by allowing the same interface to be used to specify a general class of action.””

Herbert Schildt

## About This Quote

This interpretation was drafted with AI assistance. It is one reading of the quote, not the author's own explanation.

Polymorphism lets one interface serve many data types, reducing code duplication and simplifying design.

**In simple terms:** One interface can handle many types.

Key Takeaway

Leverage polymorphism to write reusable code.

Themes

programming software design abstraction efficiency Java

Mood

technical educational

Type

Different types:0 Habits:0 Technology:1 Polymorphism Java:1 Polymorphism Helps:1 Polymorphism:1 Activities Polymorphism:0 Stack Routines:0

When to use this quote

- application development
- API design
- educational tutorials
- team coding standards

Key Concepts

polymorphism generic interfaces code reuse

Questions to Reflect On

- When does polymorphism add unnecessary abstraction?
- How to balance flexibility with clarity?

A Different Perspective

Overuse can hide complexity.

★ ★ ★ ★ ★   No ratings yet

[Habits](https://sms4smile.com/quotes/about/habits/) [Technology](https://sms4smile.com/quotes/about/technology/)

## Related quotes

> [I've always grown different types of facial hair like goofy type deals, but you know it really took off at Washington State when we…](https://sms4smile.com/quotes/gardner-minshew/i-ve-always-grown-different-types-of-facial-hair-like-goofy-type/)

[Gardner Minshew](https://sms4smile.com/quotes/author/gardner-minshew/)

> [I listened to many different types of instruments and music, and have always tried to look at the bass as an instrument as opposed…](https://sms4smile.com/quotes/billy-sheehan/i-listened-to-many-different-types-of-instruments-and-music-and-have/)

[Billy Sheehan](https://sms4smile.com/quotes/author/billy-sheehan/)

> [“If the two values have different types, try to convert them into the same type and then compare them”](https://sms4smile.com/quotes/eric-freeman/if-the-two-values-have-different-types-try-to-convert-them-into-the/)

[Eric Freeman](https://sms4smile.com/quotes/author/eric-freeman/)

> [I think the only way one can really determine whether extremism in the defense of liberty is justified, is not to approach it as…](https://sms4smile.com/quotes/malcolm-x/i-think-the-only-way-one-can-really-determine-whether-extremism-in/)

[Malcolm X](https://sms4smile.com/quotes/author/malcolm-x/)

> [“EXERCISE Creating Authentic Relationships The questions below deal with issues most people take for granted and let society define for them. You can start…](https://sms4smile.com/quotes/tristan-taormino/exercise-creating-authentic-relationships-the-questions-below-deal/)

[Tristan Taormino](https://sms4smile.com/quotes/author/tristan-taormino/)

> [I've been fortunate to play many different types of characters thus far. However, I really enjoy playing roles that are different than who I…](https://sms4smile.com/quotes/gina-holden/i-ve-been-fortunate-to-play-many-different-types-of-characters-thus/)

[Gina Holden](https://sms4smile.com/quotes/author/gina-holden/)

> [I like to keep almonds in my pantry. I also like to keep fruit on hand, just different types depending on the season. And…](https://sms4smile.com/quotes/alison-sweeney/i-like-to-keep-almonds-in-my-pantry-i-also-like-to-keep-fruit-on-hand/)

[Alison Sweeney](https://sms4smile.com/quotes/author/alison-sweeney/)

> [It's hard to give specific advice because there's so many different types of animals. In making movies, you just have to figure out what…](https://sms4smile.com/quotes/anthony-russo/it-s-hard-to-give-specific-advice-because-there-s-so-many-different/)

[Anthony Russo](https://sms4smile.com/quotes/author/anthony-russo/)

> [Most of the things that really matter require faith. 'How do I know that my wife loves me?' 'How do I know that Mozart's…](https://sms4smile.com/quotes/n-t-wright-2/most-of-the-things-that-really-matter-require-faith-how-do-i-know/)

[N. T. Wright](https://sms4smile.com/quotes/author/n-t-wright-2/)

> [Why can't all different types of women be considered beautiful? Why can't we can't we all be considered possible love interests?](https://sms4smile.com/quotes/margaret-cho/why-can-t-all-different-types-of-women-be-considered-beautiful-why/)

[Margaret Cho](https://sms4smile.com/quotes/author/margaret-cho/)

> [I have to represent. I feel proud to have a culture that's different... and proud to be a Latina. We're not all categorized as…](https://sms4smile.com/quotes/natalie-martinez/i-have-to-represent-i-feel-proud-to-have-a-culture-that-s-different/)

[Natalie Martinez](https://sms4smile.com/quotes/author/natalie-martinez/)

> [I want 'Scars to Your Beautiful' to reach different types of women. The girl I am talking about, it's me, it's you - it's…](https://sms4smile.com/quotes/alessia-cara/i-want-scars-to-your-beautiful-to-reach-different-types-of-women-the/)

[Alessia Cara](https://sms4smile.com/quotes/author/alessia-cara/)

> [Because YouTube is focused on a lot of different types of content at the same time, it has many opportunities, and the hardest thing…](https://sms4smile.com/quotes/robert-kyncl/because-youtube-is-focused-on-a-lot-of-different-types-of-content-at/)

[Robert Kyncl](https://sms4smile.com/quotes/author/robert-kyncl/)

> [We do need different types of propulsion to get to Mars. I wrote one of the first Ph.D. theses on that in the 1960s.](https://sms4smile.com/quotes/edgar-mitchell/we-do-need-different-types-of-propulsion-to-get-to-mars-i-wrote-one/)

[Edgar Mitchell](https://sms4smile.com/quotes/author/edgar-mitchell/)

> [It's really kind of a luxury for an actor to have the opportunity to show such different types of characters. I actually left 'Cowboys…](https://sms4smile.com/quotes/olivia-wilde/it-s-really-kind-of-a-luxury-for-an-actor-to-have-the-opportunity-to/)

[Olivia Wilde](https://sms4smile.com/quotes/author/olivia-wilde/)

## More Different types quotes

> [I've always grown different types of facial hair like goofy type deals, but you know it really took off at Washington State when we…](https://sms4smile.com/quotes/gardner-minshew/i-ve-always-grown-different-types-of-facial-hair-like-goofy-type/)

[Gardner Minshew](https://sms4smile.com/quotes/author/gardner-minshew/)

> [We do need different types of propulsion to get to Mars. I wrote one of the first Ph.D. theses on that in the 1960s.](https://sms4smile.com/quotes/edgar-mitchell/we-do-need-different-types-of-propulsion-to-get-to-mars-i-wrote-one/)

[Edgar Mitchell](https://sms4smile.com/quotes/author/edgar-mitchell/)

> [Because YouTube is focused on a lot of different types of content at the same time, it has many opportunities, and the hardest thing…](https://sms4smile.com/quotes/robert-kyncl/because-youtube-is-focused-on-a-lot-of-different-types-of-content-at/)

[Robert Kyncl](https://sms4smile.com/quotes/author/robert-kyncl/)

> [I want 'Scars to Your Beautiful' to reach different types of women. The girl I am talking about, it's me, it's you - it's…](https://sms4smile.com/quotes/alessia-cara/i-want-scars-to-your-beautiful-to-reach-different-types-of-women-the/)

[Alessia Cara](https://sms4smile.com/quotes/author/alessia-cara/)

> [I have to represent. I feel proud to have a culture that's different... and proud to be a Latina. We're not all categorized as…](https://sms4smile.com/quotes/natalie-martinez/i-have-to-represent-i-feel-proud-to-have-a-culture-that-s-different/)

[Natalie Martinez](https://sms4smile.com/quotes/author/natalie-martinez/)

> [Why can't all different types of women be considered beautiful? Why can't we can't we all be considered possible love interests?](https://sms4smile.com/quotes/margaret-cho/why-can-t-all-different-types-of-women-be-considered-beautiful-why/)

[Margaret Cho](https://sms4smile.com/quotes/author/margaret-cho/)

> [Most of the things that really matter require faith. 'How do I know that my wife loves me?' 'How do I know that Mozart's…](https://sms4smile.com/quotes/n-t-wright-2/most-of-the-things-that-really-matter-require-faith-how-do-i-know/)

[N. T. Wright](https://sms4smile.com/quotes/author/n-t-wright-2/)

> [It's hard to give specific advice because there's so many different types of animals. In making movies, you just have to figure out what…](https://sms4smile.com/quotes/anthony-russo/it-s-hard-to-give-specific-advice-because-there-s-so-many-different/)

[Anthony Russo](https://sms4smile.com/quotes/author/anthony-russo/)

> [I like to keep almonds in my pantry. I also like to keep fruit on hand, just different types depending on the season. And…](https://sms4smile.com/quotes/alison-sweeney/i-like-to-keep-almonds-in-my-pantry-i-also-like-to-keep-fruit-on-hand/)

[Alison Sweeney](https://sms4smile.com/quotes/author/alison-sweeney/)

> [I've been fortunate to play many different types of characters thus far. However, I really enjoy playing roles that are different than who I…](https://sms4smile.com/quotes/gina-holden/i-ve-been-fortunate-to-play-many-different-types-of-characters-thus/)

[Gina Holden](https://sms4smile.com/quotes/author/gina-holden/)

> [“EXERCISE Creating Authentic Relationships The questions below deal with issues most people take for granted and let society define for them. You can start…](https://sms4smile.com/quotes/tristan-taormino/exercise-creating-authentic-relationships-the-questions-below-deal/)

[Tristan Taormino](https://sms4smile.com/quotes/author/tristan-taormino/)

> [I think the only way one can really determine whether extremism in the defense of liberty is justified, is not to approach it as…](https://sms4smile.com/quotes/malcolm-x/i-think-the-only-way-one-can-really-determine-whether-extremism-in/)

[Malcolm X](https://sms4smile.com/quotes/author/malcolm-x/)

> [“If the two values have different types, try to convert them into the same type and then compare them”](https://sms4smile.com/quotes/eric-freeman/if-the-two-values-have-different-types-try-to-convert-them-into-the/)

[Eric Freeman](https://sms4smile.com/quotes/author/eric-freeman/)

> [I listened to many different types of instruments and music, and have always tried to look at the bass as an instrument as opposed…](https://sms4smile.com/quotes/billy-sheehan/i-listened-to-many-different-types-of-instruments-and-music-and-have/)

[Billy Sheehan](https://sms4smile.com/quotes/author/billy-sheehan/)

> [It's really kind of a luxury for an actor to have the opportunity to show such different types of characters. I actually left 'Cowboys…](https://sms4smile.com/quotes/olivia-wilde/it-s-really-kind-of-a-luxury-for-an-actor-to-have-the-opportunity-to/)

[Olivia Wilde](https://sms4smile.com/quotes/author/olivia-wilde/)

Browse all 526 Different types quotes

```json
{
    "@context": "https://schema.org",
    "@graph": [
        {
            "@type": "Quotation",
            "text": "“For example, consider a stack (which is a first-in, last-out list). You might have a program that requires three different types of stacks. One stack is used for integer values, one for floating-point values, and one for characters. In this case, the algorithm that implements each stack is the same, even though the data being stored differs. In a non-object-oriented language, you would be required to create three different sets of stack routines, with each set using different names. However, because of polymorphism, in Java you can create one general set of stack routines that works for all three specific situations. This way, once you know how to use one stack, you can use them all. More generally, the concept of polymorphism is often expressed by the phrase “one interface, multiple methods.” This means that it is possible to design a generic interface to a group of related activities. Polymorphism helps reduce complexity by allowing the same interface to be used to specify a general class of action.”",
            "creator": {
                "@type": "Person",
                "name": "Herbert Schildt"
            },
            "isPartOf": {
                "@id": "https://sms4smile.com/quotes/#website"
            },
            "url": "https://sms4smile.com/quotes/herbert-schildt/for-example-consider-a-stack-which-is-a-first-in-last-out-list-you/",
            "about": {
                "@type": "Thing",
                "name": "Different types"
            },
            "@id": "https://sms4smile.com/quotes/herbert-schildt/for-example-consider-a-stack-which-is-a-first-in-last-out-list-you/#quotation",
            "image": {
                "@type": "ImageObject",
                "@id": "https://sms4smile.com/quotes/i/e3e/herbert-schildt-177770_different-types_for-example-consider-a-stack-which-is-a_2226549.jpg",
                "contentUrl": "https://sms4smile.com/quotes/i/e3e/herbert-schildt-177770_different-types_for-example-consider-a-stack-which-is-a_2226549.jpg",
                "url": "https://sms4smile.com/quotes/i/e3e/herbert-schildt-177770_different-types_for-example-consider-a-stack-which-is-a_2226549.jpg",
                "width": 1080,
                "height": 1080,
                "caption": "“For example, consider a stack (which is a first-in, last-out list). You might have a program that requires…” — Herbert Schildt",
                "creditText": "SMS4Smile Quotes",
                "creator": {
                    "@id": "https://sms4smile.com/quotes/#organization"
                }
            }
        },
        {
            "@type": "BreadcrumbList",
            "itemListElement": [
                {
                    "@type": "ListItem",
                    "position": 1,
                    "name": "Home",
                    "item": "https://sms4smile.com/"
                },
                {
                    "@type": "ListItem",
                    "position": 2,
                    "name": "Quotes",
                    "item": "https://sms4smile.com/quotes/"
                },
                {
                    "@type": "ListItem",
                    "position": 3,
                    "name": "Herbert Schildt",
                    "item": "https://sms4smile.com/quotes/author/herbert-schildt/"
                },
                {
                    "@type": "ListItem",
                    "position": 4,
                    "name": "“For example, consider a stack (which...",
                    "item": "https://sms4smile.com/quotes/herbert-schildt/for-example-consider-a-stack-which-is-a-first-in-last-out-list-you/"
                }
            ],
            "@id": "https://sms4smile.com/quotes/herbert-schildt/for-example-consider-a-stack-which-is-a-first-in-last-out-list-you/#breadcrumb"
        },
        {
            "@type": "WebSite",
            "@id": "https://sms4smile.com/quotes/#website",
            "name": "SMS4Smile Quotes",
            "url": "https://sms4smile.com/quotes/",
            "publisher": {
                "@id": "https://sms4smile.com/quotes/#organization"
            }
        },
        {
            "@type": "Organization",
            "@id": "https://sms4smile.com/quotes/#organization",
            "name": "SMS4Smile Quotes",
            "url": "https://sms4smile.com/quotes/",
            "logo": {
                "@type": "ImageObject",
                "url": "https://sms4smile.com/quotes/wp-content/themes/sq/assets/icons/icon-512.png",
                "width": 512,
                "height": 512
            }
        }
    ]
}
```
