Démonstration de autoboxing et unbox: Exemple simple*

Author:


{filelink=11192}

public class AutoBox {
  public static void main(String args[]) {

    Integer obI = 150; // autobox d'un int

    int i = obI; // auto-unbox  de int

    System.out.println(i + " et " + obI);  // Ce programme affiche 150 et 150
  }
}

Leave a Reply

Your email address will not be published. Required fields are marked *