What is parametric polymorphism in Java (with example)?

后端 未结 3 603
温柔的废话
温柔的废话 2021-02-07 07:18

It is my understanding that parametric polymorphism is a technique which allows uniform actions over a variety of data(types). Is my knowledge correct?

Is this example p

3条回答
  •  孤街浪徒
    2021-02-07 08:04

    Precisely. Parametric polymorphism generally refers to generics/templates.

    From wikipedia:

    Using parametric polymorphism, a function or a data type can be written generically so that it can handle values identically without depending on their type.

提交回复
热议问题