fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7.  
  8. class Shape
  9. {
  10. protected float areaOfCircle;
  11. protected float areaOfRectangle;
  12.  
  13. public void PrintCircle()
  14. {
  15. // System.out.print("The area of Circle: ", areaOfCircle, "\n");
  16. }
  17.  
  18. public void PrintRectangle()
  19. {
  20. // System.out.print("The area of Rectangle: ", areaOfRectangle, "\n");
  21. }
  22. }
  23.  
  24. class Circle extends Shape
  25. {
  26. private float radius;
  27. private float pi = 3.1417f;
  28.  
  29. public void SetRadius( float R)
  30. {
  31. radius = R;
  32. }
  33.  
  34. public void CalculateAreaOfCircle()
  35. {
  36. areaOfCircle = pi * (radius * radius);
  37. }
  38.  
  39. public void PrintCircle()
  40. {
  41. super.PrintCircle();
  42. }
  43. }
  44.  
  45. class Rectangle extends Shape
  46. {
  47. private float width;
  48. private float length;
  49.  
  50. public void SetWidth( float w)
  51. {
  52. width = w;
  53. }
  54.  
  55. public void SetLength( float l)
  56. {
  57. length = l;
  58. }
  59.  
  60. public void CalculateAreaOfRectangle()
  61. {
  62. areaOfRectangle = width * length;
  63. }
  64.  
  65. public void PrintRectangle()
  66. {
  67. super.PrintRectangle();
  68. }
  69. }
  70. /* Name of the class has to be "Main" only if the class is public. */
  71. class Project
  72. {
  73. public static void main (String[] args) throws java.lang.Exception
  74. {
  75. // your code goes here
  76.  
  77. public Circle myCircle;
  78.  
  79. }
  80. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:77: error: illegal start of expression
		public Circle myCircle;
		^
1 error
stdout
Standard output is empty