圆的面积为pi * r * r,其中r是圆的半径。
/*NowJava.com - 时代Java*/ import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class Main { public static void main(String[] args) { int radius = 0; System.out.println("Please enter radius of a circle"); try { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); radius = Integer.parseInt(br.readLine()); } catch (NumberFormatException ne) {/** 来自 nowjava - 时代Java**/ System.out.println("Invalid radius value" + ne); System.exit(0); } catch (IOException ioe) { System.out.println("IO Error :" + ioe);