Autobox et unbox: mauvaise conversion*

Author:


{filelink=11197}

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

    Integer iOb = 1000; // autobox the value 1000 

    int i = iOb.byteValue(); // manually unbox as byte !!! 

    System.out.println(i);  // does not display 1000 !
  }
}

A Voir sur le même Sujet:

  • java autobox

Leave a Reply

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