Tuesday 16 May 2017

Java Tutorial: Generics in java | Java Generics [Lower bounded wildcard in Java Generics]


Click here to watch in Youtube :
https://www.youtube.com/watch?v=M7LaKqw7tfw&list=UUhwKlOVR041tngjerWxVccw

Click the below Image to Enlarge
Java Tutorial: Generics in java | Java Generics [Lower bounded wildcard in Java Generics] 
Java Tutorial: Generics in java | Java Generics [Lower bounded wildcard in Java Generics] 
GenericDemo.java
import java.util.ArrayList;
import java.util.List;

public class GenericDemo
{

    public static void main(String[] args)
    {
        
        List<Integer> integerList = new ArrayList<Integer>();
        addIntegers(integerList);

        List<Number> numberList = new ArrayList<Number>();
        addIntegers(numberList);

    }

    public static void addIntegers(List<? super Integer> list)
    {
        list.add(new Integer(50));
        System.out.println(list);
    }

}
Output
[50]
[50]
Click the below link to download the code:
https://sites.google.com/site/ramj2eev1/home/javabasics/GenericsDemo_lower_bounded_wildcard_App.zip?attredirects=0&d=1

Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/GenericsDemo_lower_bounded_wildcard_App

Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/539015917c8406e4be671410d713073b3971d1a5/BasicJava/GenericsDemo_lower_bounded_wildcard_App/?at=master

See also:
  • All JavaEE Viedos Playlist
  • All JavaEE Viedos
  • All JAVA EE Links
  • Servlets Tutorial
  • All Design Patterns Links
  • JDBC Tutorial
  • Java Collection Framework Tutorial
  • JAVA Tutorial
  • Kids Tutorial
  • No comments:

    Post a Comment