In computer programming with object-oriented programming languages, duck typing is a style of dynamic typing in which an object's current set of methods and properties determines the valid semantics, rather than its inheritance from a particular class or implementation of a specific interface.
Consider the following pseudo-code for a duck typed language:
Interfaces can provide some of the benefits of duck typing but duck typing is distinct in that no explicit interface is defined. For example, if a third party Java library implements a class you are not allowed to modify, you cannot use an instance of the class in place of an interface you have defined yourself, whereas duck typing would allow this. Again, all of an interface must be satisfied for compatibility.
Can you clarify with an example and related articles on how Java deals with generic programming?
Can you provide an example of an algorithm (preferably simple) or generic programming you might have come across or written in Java?
Java is a statically, strongly typed programming language; the types of variables and expressions must be known at compile time, unlike dynamically typed languages like Ruby or Python where variables don't have a fixed type at compile time.
Duck typing is a feature of dynamically typed programming languages, Java does not support it because it is statically typed.
Duck typing doesn't have a lot to do with generic programming.
If you want to learn about generics in Java, then have a look at this tutorial chapter: Lesson: Generics.