无参数无返回类型方法语法格式: public static void 方法名称(){ 方法体; } class Method03{ /*练习3:输出1-100中的每个数,要求使用无参无返回类型的方法完成 无参数无返回类型 语法格式: public static void 方法名称(){ 方法体 } */ public static void print(){ for(int i = 1; i <= 100; i++){ System.out.println(i); } } } class Met
4种方法,都是四舍五入,例: import java.math.BigDecimal; import java.text.DecimalFormat; import java.text.NumberFormat; public class format { double f = 111231.5585; public void m1() { BigDecimal bg = new BigDecimal(f); double f1 = bg.setScale(2, BigDecimal.ROUND