- UID
- 24317
- 帖子
- 33306
- 积分
- 63824
- 阅读权限
- 90
- 注册时间
- 2006-7-15
- 最后登录
- 2011-6-15
- 在线时间
- 10977 小时
|
import java.util.ArrayList;
public class Test {
public static void main(String[] args) {
int[] a = { 1, 2, 3, 4, 8 };
int[] b = { 1, 2, 3, 5 };
ArrayList c = new ArrayList();
for (int i ...
gaoshouzizhong 发表于 2010-11-6 13:28 ![]()
你这种sb都会啊,用的ArrayList api嘛,那么简单
说了不能用java的api
ps. 我做出来了,用的自己的api
效果如下
public class SetTheoryShowCase {
public static void main(String[] args) {
SetTheory a, b, c;
a = new SetTheory();
b = new SetTheory();
a.lisaa(1);
a.lisaa(2);
a.lisaa(3);
a.lisaa(4);
a.lisaa(5);
b.lisaa(1);
b.lisaa(2);
b.lisaa(3);
b.lisaa(6);
c = JoukkoOp.yhdiste(a, b);
System.out.println("a = " + a);
System.out.println("b = " + b);
System.out.println("c = " + c);
System.out.println();
c = JoukkoOp.leikkaus(a, b);
System.out.println("a = " + a);
System.out.println("b = " + b);
System.out.println("c = " + c);
System.out.println();
c = JoukkoOp.erotus(a, b);
System.out.println("a = " + a);
System.out.println("b = " + b);
System.out.println("c = " + c);
System.out.println();
========================
a = { 1 2 3 4 5 }
b = { 1 2 3 6 }
c = { 1 2 3 4 5 6 }
a = { 1 2 3 4 5 }
b = { 1 2 3 6 }
c = { 1 2 3 }
a = { 1 2 3 4 5 }
b = { 1 2 3 6 }
c = { 4 5 } |
|