Exemple de conversion entre int et Integer

Author:

 map, java
{filelink=11190}


import java.util.HashMap;
import java.util.Map;

public class IntToInteger
{

  public static void main(String[] args)
  	{

    Integer x=20;

    // Integer en Int
    int age = x;

    // Int en Integer
    Integer y = x + 10;

    System.out.println ("x= "+x+", y="+y);
  }

}

Leave a Reply

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