fork(1) download
  1. class Sphere{
  2. double radius;
  3. Sphere( double r ){
  4. radius = r;
  5. }
  6. double calcVol(){
  7. return 4.0*Math.PI*radius*radius*radius/3.0;
  8. }
  9. }
  10. //(Sphereクラスを継承しているStarクラスを作成;必要なインスタンスフィールド, インスタンスメソッド, コンストラクタを設定)
  11.  
  12. class Space{
  13. public static void main(String [] args){
  14. Star s = new Star(696010.0, "太陽", "Sun");
  15. double v = s.calcVol();
  16. System.out.printf("%sの体積は%.1e立方kmです。¥n", s.showName(), v);
  17. s.explainStar();
  18. }
  19. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:14: error: cannot find symbol
	Star s = new Star(696010.0, "??", "Sun");
	^
  symbol:   class Star
  location: class Space
Main.java:14: error: cannot find symbol
	Star s = new Star(696010.0, "??", "Sun");
	             ^
  symbol:   class Star
  location: class Space
2 errors
stdout
Standard output is empty