testset.java.bak
来自「数据结构(java描述)课件(第二讲:线性结构)」· BAK 代码 · 共 44 行
BAK
44 行
public class TestSet{
public static void main(String[] args){
MySet os1 = new MySet ();
MySet os2 = new MySet ();
//add null, 0, 2, 5
os1.add(new Integer(0));
os1.add(null);
os1.add(new Integer(2));
os1.add(new Integer(0));
os1.add(new Integer(5));
os1.add(null);
os2.add(new Integer(5));
os2.add(new Integer(0));
os2.add(new Integer(2));
os2.add(null);
os2.add(new Integer(5));
os2.add(new Integer(2));
if (os1.include(os2))
{
if (os2.include(os1))
{
System.out.println("集合os1和os2相等");
}
else
{
System.out.println("集合os2是os1的子集");
}
}
else
{
System.out.println("集合os1和os2相等");
}
System.out.print("os1中的元素:");
os1.print();
System.out.println();
System.out.print("os2中的元素:");
os2.print();
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?