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

📄 instanceof.java

📁 java程序设计源代码
💻 JAVA
字号:
class InstanceOf 
{
	public static void main(String[] args) 
	{
		Object [] things = new Object[3];
		things[0] = new Integer(4);
		things[1] = new Double(3.14);
		things[2] = new Double(2.09);
		double s = 0;
		for( int i=0; i<things.length; i++ ){
			if( things[i] instanceof Integer )
				s += ((Integer)things[i]).intValue();
			else if( things[i] instanceof Double )
				s += ((Double)things[i]).doubleValue();
		}
		System.out.println("sum=" + s);
	}
}

⌨️ 快捷键说明

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