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

📄 wildcard.java

📁 Java面向对象编程(随书配套源代码) 阐述了面向对象编程的思想
💻 JAVA
字号:
package chapter11;
import chapter7.*;
public class Wildcard 
{
	public static boolean isEmpty( Stack<?> s)
	{
		return s.isEmpty();
	}
	
	public static boolean isEmpty2(Stack2<?> s)
	{
		return s.isEmpty();
	}
	
   public static void main(String args[])
   {
	   Stack<String>  strStack = new Stack<String> (10);
	   Stack<Integer> iStack = new Stack<Integer> (10);
	   Stack<Double>  dStack = new Stack<Double> (10);
	
	   strStack.push("String");
	   if(!Wildcard.isEmpty(strStack))
	   {
		   System.out.println(strStack.pop());
	   }
	   if(!Wildcard.isEmpty(iStack) && !Wildcard.isEmpty(dStack) )
	   {
		   System.out.println("iStack和dStack 都是空栈");
	   }
	   Stack2<Duck> duckStack = new Stack2<Duck> (10);
	   Stack2<Sheep> sheepStack = new Stack2<Sheep> (10);
	   if(!Wildcard.isEmpty2(duckStack) && !Wildcard.isEmpty2(sheepStack) )
	   {
		   System.out.println("duck和sheepStack 都是空栈");
	   }   
   }
}

⌨️ 快捷键说明

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