提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
使用Java运算子的范例
public class Main { public static void main ( String[] args ) { int num = 1110;//来自 n o w j a v a . c o m double realNum = 25.1115F; double veryBigNum = 215.8 / 0.0; double garbage = 0.0 / 0.0; boolean test = true; System.out.println ("num = " + num); System.out.println ("realNum = " + realNum); System.out.println ("veryBigNum = " + veryBigNum); System.out.println ("garbage = " + garbage); System.out.println ("test = " + test); System.out.println ("Maximum int = " + Integer.MAX_VALUE); System.out.println ("Maximum double = " + Double.MAX_VALUE); System.out.println ("12.5 + 100 = " + (12.5 + 100)); System.out.println ("12.5 - 100 = " + (12.5 - 100)); System.out.println ("12.5 * 100 = " + (12.5 * 100)); /* n o w j a v a . c o m 提 供 */ System.out.println ("12.5 / 100 = " + (12.5 / 100)); System.out.println (