题解 | #类型转换#
类型转换
http://www.nowcoder.com/practice/0540ee3987b64bd7bb93adb5bd0e35d4
主要就是将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......
return (int)d;
}
}