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

  • Home
  • SEARCH
  • 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 315669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T08:18:46+00:00 2026-05-12T08:18:46+00:00

I have read O’Reilly book, in that I came to know this get-put principle

  • 0

I have read O’Reilly book, in that I came to know this get-put principle.

  • Use an extends wildcard when you only get values out of a structure.
  • Use a super wildcard when you only put values into a structure.
  • And don’t use a wildcard when you both want to get and put from/to a structure.

Exceptions are:

  • You cannot put anything into a type declared with an extends wildcard except for the value null, which belongs to every reference type.

  • You cannot get anything out from a type declared with an super wildcard except for a value of type Object, which is a super type of every reference type.

Can anyone help me to explore this rule at depth? If possible, please put them hierarchical manner.

  • 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-05-12T08:18:47+00:00Added an answer on May 12, 2026 at 8:18 am

    Consider a bunch of bananas. This is a Collection<? extends Fruit> in that it’s a collection of a particular kind of fruit – but you don’t know (from that declaration) what kind of fruit it’s a collection of. You can get an item from it and know it will definitely be a fruit, but you can’t add to it – you might be trying to add an apple to a bunch of bananas, which would definitely be wrong. You can add null to it, as that will be a valid value for any kind of fruit.

    Now consider a fruitbowl. This is a Collection<? super Banana>, in that it’s a collection of some type “greater than” Banana (for instance, Collection<Fruit> or Collection<TropicalFruit>). You can definitely add a banana to this, but if you fetch an item from the bowl you don’t know what you’ll get – it may well not be a banana. All you know for sure is that it will be a valid (possibly null) Object reference.

    (In general, for Java generics questions, the Java Generics FAQ is an excellent resource which contains the answer to almost anything generics-related you’re likely to throw at it.)

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

Sidebar

Related Questions

I have read on the adobe website that you could use php with flex.I
i have read this article ScuttGu for making use of User control to make
I have read that it is better performance to have jquery use a DIV's
I have read this: How to get the my system's IP address But it's
I have read this article on Codeproject, but I don't know how to apply
I have read in Design Patterns book for the gang of four that the
I have read a bunch of forums on this but none have solved my
I have read that GLSL (specifically v1.0.17: my application is running under WebGL) compilers
I have read numerous people with this question and have tried numerous strategies. However,
I have read thru a number of other questions similar to this one -

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.