实例 Java 隐式转换

x
 
public class Main {
  public static void main(String[] args) {
    int myInt = 9;
    double myDouble = myInt; // Automatic casting: int to double
    System.out.println(myInt);
    System.out.println(myDouble);
  }
}
                    

输出结果

9
9.0