题解 | #类型转换#
类型转换
https://www.nowcoder.com/practice/0540ee3987b64bd7bb93adb5bd0e35d4?tpId=220&tqId=2220136&ru=/exam/oj&qru=/ta/primary-grammar-java/question-ranking&sourceUrl=%2Fexam%2Foj
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 i = (int)d; return i; } }
这题就是强制类型转换
#java基础知识#