fork download
  1. import java.util.Scanner;
  2. public class CircleAreaCalculator {
  3. public static void main(String[] args) {
  4. Scanner scan = new Scanner(System.in);
  5. System.out.print("กรุณากรอกตัวเลขของรัศมี : ");
  6. double r = scan.nextDouble();
  7. scan.close();
  8. System.out.printf("\r\nพื้นที่ของวงกลม คือ %.2f", Math.PI * (r * r));
  9. }
  10. }
  11.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:2: error: class CircleAreaCalculator is public, should be declared in a file named CircleAreaCalculator.java
 public class CircleAreaCalculator {
        ^
1 error
stdout
Standard output is empty