Thanks, it worked. I tried in a smaller program like this:
import java.text.DecimalFormat;
public class Matte {
public static final double PI = 3.14;
public static void main (String[] args)
{
int r=3;
int h=7;
System.out.print(volume(r,h));
}
public static double volume (int r, int h)
{
DecimalFormat df = new DecimalFormat("#.##");
double volym=PI*r*r*h;
String volym2=df.format(volym);
volym2=(replace1(volym2));
return Double.parseDouble(volym2);
}
public static String replace1(String volym2)
{
return volym2.replaceAll("," , ".");
}
}