> ## Documentation Index
> Fetch the complete documentation index at: https://docs.syntblaze.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Java Lower Bounded Wildcard

A lower bounded wildcard in Java restricts an unknown generic type to be a specific class or any of its superclasses. Denoted by the `<? super T>` syntax, it establishes a lower limit on the type hierarchy, meaning the parameterized type must be `T` or an ancestor of `T` (up to `java.lang.Object`).

## Syntax

The wildcard is declared using the `?` character, followed by the `super` keyword, and then the lower bound type.

```java theme={"dark"}
List<? super Number> lowerBoundedList;
```

## Assignment Compatibility

When a reference is declared with a lower bounded wildcard, it can point to a generic object parameterized with the exact type or any of its supertypes.

For example, a `List<? super Number>` can accept:

* `List<Number>`
* `List<Object>`

It will reject `List<Integer>` or `List<String>`, resulting in a compile-time error, because neither `Integer` nor `String` are superclasses of `Number`.

## Read and Write Mechanics

The primary technical implication of a lower bounded wildcard dictates how the compiler handles reading from and writing to the generic structure.

### Writing (Insertion)

You can safely add instances of the lower bound type `T`, or any of its subclasses, into the structure. The compiler allows this because a collection designed to hold `T` or any superclass of `T` is inherently capable of holding a `T` (and by extension, any valid subclass of `T`).

### Reading (Retrieval)

Reading from a lower bounded wildcard is highly restricted. Because the compiler only knows that the collection holds *some* supertype of `T`, it cannot guarantee the specific type of the elements being retrieved. The only safe assumption the compiler can make is that the elements are instances of `java.lang.Object`.

## Code Visualization

```java theme={"dark"}
// The reference can point to a List of Number or Object
List<? super Number> list = new ArrayList<Object>();

// 1. WRITING: Allowed for Number and its subclasses
list.add(Integer.valueOf(10));  // Integer is a subclass of Number
list.add(Double.valueOf(20.5)); // Double is a subclass of Number

// WRITING: Rejected for superclasses or unrelated types
// list.add(new Object()); // Compile-time error (Object is a superclass, not a subclass)
// list.add("String");     // Compile-time error (String is unrelated to Number)

// 2. READING: Elements lose their specific type identity
Object obj = list.get(0); // Allowed: Guaranteed to be at least an Object

// READING: Rejected without explicit downcasting
// Number n = list.get(0);  // Compile-time error
// Integer i = list.get(0); // Compile-time error
```

## Type System Role

In Java's generic type system, lower bounded wildcards implement contravariance. They invert the standard subtyping relationship, allowing a generic type to accept a wider, more generic type argument. This mechanic enforces type safety for operations that mutate (consume) data, ensuring that heap pollution does not occur when passing generic collections across different API boundaries.

<div
  style={{ 
display: "flex", 
justifyContent: "space-between", 
alignItems: "center", 
maxWidth: "754px", 
padding: "1rem 0",
marginBottom: "24px"
}}
>
  <span style={{ fontWeight: "bold", fontSize: "1.25rem", color: "var(--tw-prose-headings)", fontFamily: "Inter, ui-sans-serif, system-ui, sans-serif" }}>Tired of Poor Java Skills? Fix That With Deep Grasping!</span>

  <a
    href="https://syntblaze.com"
    target="_blank"
    style={{ 
  marginLeft: "24px",
  textDecoration: "none", 
  backgroundColor: "#007AFF",
  color: "#ffffff", 
  padding: "6px 16px", 
  borderRadius: "16px",
  fontSize: "0.9rem",
  fontWeight: "600",
  textAlign: "center",
  transition: "background-color 0.2s ease"
}}
  >
    Learn More
  </a>
</div>

<div style={{ display: "flex", gap: "12px", flexWrap: "wrap" }}>
  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/skill-tracking.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=b9b0305c93bb501c9e767b5c76c88835" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/skill-tracking.png" />

  <img src="https://mintcdn.com/syntblazellc/23tyuOzaWS88qFlc/images/nuggets.png?fit=max&auto=format&n=23tyuOzaWS88qFlc&q=85&s=c86c80197299762989e9b882419b2109" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/nuggets.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/bite-sized-exercises.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=a65f9a38c37ff28ab73ed783c53c60e3" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/bite-sized-exercises.png" />
</div>

<div style={{ display: "flex", gap: "12px", flexWrap: "wrap", marginTop: "12px" }}>
  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/mastery-chain.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=748a1763454713e679260fbb95f154a2" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/mastery-chain.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/element-previews.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=242f61448ff5dd6deaaab2dccc13b507" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/element-previews.png" />

  <img src="https://mintcdn.com/syntblazellc/-L0ums_2lctDSZ1l/images/element-explanations.png?fit=max&auto=format&n=-L0ums_2lctDSZ1l&q=85&s=cf0fc1c31f9cd0fc26716781be05fbc9" style={{ width: "30%", minWidth: 60 }} width="621" height="1344" data-path="images/element-explanations.png" />
</div>
