/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package ldecimalformat;
import java.text.DecimalFormat;
/**
*
* @author andi m
*/
public class LDecimalFormat {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
DecimalFormat C=new DecimalFormat("0.00");
double A=6,B=9;
double ans=A/B;
//Sebelum pembulatan
System.out.println(ans);
//setelah pembulatan
System.out.println(C.format(ans));
}
}
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package ldecimalformat;
import java.text.DecimalFormat;
/**
*
* @author andi m
*/
public class LDecimalFormat {
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
DecimalFormat C=new DecimalFormat("0.00");
double A=6,B=9;
double ans=A/B;
//Sebelum pembulatan
System.out.println(ans);
//setelah pembulatan
System.out.println(C.format(ans));
}
}
No comments