Lets an double type variable x is 232.1234567
HOW CAN I PRINT ONLY Two value after the .means i want to print 232.12
help me pls.
Printable View
Lets an double type variable x is 232.1234567
HOW CAN I PRINT ONLY Two value after the .means i want to print 232.12
help me pls.
Read this:
http://www.particle.kth.se/~lindsey/...terPrintf.html
Here is an example:
Code:public class DoubleExample {
static double numb = 12.34567;
public static void main(String[] args) {
System.out.printf("%.2f", numb);
}
}