outputs 123.45. zero(0) is gone. what am i doing wrong? thanx...PHP Code:class Document3{
public static void main(String args[]){
String s="123.450";
System.out.println(Float.parseFloat(s));
}
}
Printable View
outputs 123.45. zero(0) is gone. what am i doing wrong? thanx...PHP Code:class Document3{
public static void main(String args[]){
String s="123.450";
System.out.println(Float.parseFloat(s));
}
}
You are doing nothing wrong. 0.450 is the same as 0.45
how can i be stupid. sorry for bothers... and oh... thankx :)
just one more thing... how do i do something like
in java... thanx again...PHP Code:printf("%.3f",x);
Look at the classes in java.text
got it. assuming the parsed string.
thanx very much... :)PHP Code:import java.text.*;
public class Document3{
public static void main(String args[]){
DecimalFormat df=new DecimalFormat("##0.000");
System.out.println(df.format(123.450));
}
}
:thumb: Anytime