输入描述:
随机double类型变量
输出描述:
转化后的int类型变量
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); double d = scanner.nextDouble(); System.out.println(Main.typeConversion(d)); } public static int typeConversion(double d){ //write your code here...... } }
转化后的int类型变量 如下:
import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); double d = scanner.nextDouble(); System.out.println(Main.typeConversion(d)); } public static int typeConversion(double d){ return (int)d; //返回强制转换的int类型就可以啦 } }