Java中如何将float转换为int呢?
下文笔者讲述java中将float转换为int的方法及示例分享
float转int的实现思路 使用Math.round()方法即可实现float转int例:float转int的示例
/** * Java265.com float转int的示例 */ public static void main(String[] args) { float f = 98.89f; int i = Math.round(f); System.out.println(i); }

版权声明
本文仅代表作者观点,不代表本站立场。
本文系作者授权发表,未经许可,不得转载。