⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 chapter14n0.java

📁 JAVA源代码程序aashjkjhkjhkjhjkhkj
💻 JAVA
字号:
/** * program to test the "Solid" abstract class */public class Chapter14n0    {    public static void main(String[] args)	{	Solid aSolid ;		// valid declaration.  Note we haven't				// used a constructor	Sphere aSphere = new Sphere(4.0) ;	aSolid = aSphere ;	System.out.println(aSolid.volume()) ;	System.out.println() ;	Solid[] collection = new Solid[4] ;	Sphere s1 = new Sphere(4) ;	collection[0] = s1 ;	Cuboid c1 = new Cuboid(2, 3, 4) ;	collection[1] = c1 ;	Cylinder cyl = new Cylinder(4, 2) ;	collection[2] = cyl ;	Sphere s2 = new Sphere(3) ;	collection[3] = s2 ;	double totalVolume = 0.0 ;	for (int i = 0 ; i < 4 ; i++)	    {	    totalVolume = totalVolume + collection[i].volume() ;	    }	System.out.println("total volume = " + totalVolume) ;	} // end of main method    } // end of class Chapter14n0

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -