testset.java

来自「集合类」· Java 代码 · 共 38 行

JAVA
38
字号
import java.io.*;
public class TestSet
{
	public static void main(String[] args)
	{
		int a=0,b=0;
		String  digit;
		int test=1;
		Set sa=null;
		Set sb=null;
		Set sc=null;
		Set sd=null;
		System.out.println("集合A的大小:");
		try
		{
			BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
			digit=br.readLine( );
			a=Integer.parseInt(digit);
		}catch(IOException e){}
		System.out.println("集合B的大小:");
		try
		{
			BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
			digit=br.readLine( );
			b=Integer.parseInt(digit);
		}catch(IOException e){}
		sa=new Set(a);
		sb=new Set(b);
		sc=sa;sd=sb;
		System.out.println("集合A:   "+sa);
		System.out.println("集合B:   "+sb);
		sa.unite(sb);
		System.out.println("集合A并B:"+sa);
		sc.intersection(sd);
		System.out.println("集合A交B:"+sc);
	}
}

⌨️ 快捷键说明

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