Java Math divide() 方法 Java Math compareTo() 方法 Java Math divide(divisor, roundingMode) Java Math divide() 方法 package com.codingdict; import java.math.*; public class BigDecimalDemo { public static void main(String[] args) { // create 3 BigDecimal objects BigDecimal bg1, bg2, bg3; bg1 = new BigDecimal("45"); bg2 = new BigDecimal("5"); bg3 = bg1.divide(bg2); // divide bg1 with bg2 String str = "Division result is " +bg3; // print bg3 value System.out.println( str ); } } Java Math compareTo() 方法 Java Math divide(divisor, roundingMode)