Hi, I m trying to make a method in which i want to format a fraction into percent format. But i m unable to remove th errors in it. If som1 can help me out... below is the code i have written...
BigDecimal number = 8.375; // This is the value I want to format public static final String DEFAULT_PERCENT_FORMAT = "#0.0#";
public String formatPercent(BigDecimal amount) { // Its showing syntax error here
DecimalFormat format = null; format = new DecimalFormat(getProperty(DEFAULT_PERCENT_FORMAT)); return format.format(amt); }
} }
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35253
7
posted
0
The brackets are nested incorrectly, so that the formatPercent method is now inside the main method. In Java, you can't declare a method inside of another method.