50,523
社区成员
发帖
与我相关
我的任务
分享
public class TestDeom {
public static void main(String[] args) {
// TODO Auto-generated method stub
Miami detroit=new Detroit("底特律活塞队(1989年、1990年、2004年)");
Miami philadelphia=new Philadelphia("费城76队(1955年、1967年、1983年)");
detroit.show();
philadelphia.show();
}
}
class Miami<T>{
public T t;
Miami(T t){
this.t=t;
}
void show(){
System.out.println(t);
}
}
class Detroit extends Miami<String>{
public Detroit(String t) {
super(t);
// TODO Auto-generated constructor stub
}
}
class Philadelphia extends Miami<String>{
public Philadelphia(String t) {
super(t);
// TODO Auto-generated constructor stub
}
}
[/quote]
大佬 还可以仔细点吗 有些我没接触过
public class TestDeom {
public static void main(String[] args) {
// TODO Auto-generated method stub
Miami detroit=new Detroit("底特律活塞队(1989年、1990年、2004年)");
Miami philadelphia=new Philadelphia("费城76队(1955年、1967年、1983年)");
detroit.show();
philadelphia.show();
}
}
class Miami<T>{
public T t;
Miami(T t){
this.t=t;
}
void show(){
System.out.println(t);
}
}
class Detroit extends Miami<String>{
public Detroit(String t) {
super(t);
// TODO Auto-generated constructor stub
}
}
class Philadelphia extends Miami<String>{
public Philadelphia(String t) {
super(t);
// TODO Auto-generated constructor stub
}
}
public class Pair<K, V> {
public K[] getKey;
public V[] getValue;
public Pair(K[] getKey, V[] getValue) {
super();
this.getKey = getKey;
this.getValue = getValue;
}
public void showBookInfo() {
System.out.println("银行名称\t\t存款时间\t户名\t币种\t存款金额\t账户余额");
System.out.println("----------------------------------------------");
for (int i = 0; i <getKey.length;i++)
{
System.out.print(getValue[i]+"\t");
}
}
public static void main(String[] args) {
// TODO Auto-generated method stub
Integer[] key= {1,2,3,4};
String[] info= {"张三","Rmb","8888.00RMB","18,888.88RMB"};
Pair<Integer, String> pair=new Pair<Integer, String>(key, info);
pair.showBookInfo();
}
}