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

📄 tupletest16.java

📁 JAVA编程思想第四版英文原版习题答案. pdf原版的
💻 JAVA
字号:
// generics/TupleTest16.java
// TIJ4 Chapter Generics, Exercise 16, page 641
// Add a SixTuple to Tuple.java and test it in TupleTest2.java.
import org.greggordon.util.*;
import static org.greggordon.util.Tuple.*;

public class TupleTest16 {
	static TwoTuple<String,Integer> f() {
		return tuple("hi", 47);
	}
	static TwoTuple f2() { return tuple("hi", 47); }
	static ThreeTuple<Amphibian,String,Integer> g() {
		return tuple(new Amphibian(), "hi", 47);
	}
	static FourTuple<Vehicle,Amphibian,String,Integer> h() {
		return tuple(new Vehicle(), new Amphibian(), "hi", 47);
	}
	static FiveTuple<Vehicle,Amphibian,String,Integer,Double> k() {
		return tuple(new Vehicle(), new Amphibian(), "hi", 47,
		11.1);
	}
	// must use full name to distinguish from the SixTuple of Ex3:
	static org.greggordon.util.SixTuple<Robot,Vehicle,Amphibian,String,Integer,Double> m() {
		return tuple(new Robot(), new Vehicle(), new Amphibian(), "hi", 47, 11.1);
	}
	public static void main(String[] args) {
		TwoTuple<String,Integer> ttsi = f();
		System.out.println(ttsi);
		System.out.println(f2());
		System.out.println(g());
		System.out.println(h());
		System.out.println(k());
		System.out.println(m());
	}
}

⌨️ 快捷键说明

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