- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
class Car<T>{
public T type;
public String name;
public int speed;
public double price;
private Car cr;
public Car(Car cr){ this.cr=cr;}
public Car(){ this.cr=new Car<T>(this);}
public String toString(){
return "type "+type+" name "+name;
}
public T toStringCar(){
return (T) this.cr.toString();
}
public void printing(){
Car cr1=this.cr;
for(;;){
cr1=cr1.cr;
System.out.println(cr1);
}
}
}
public class HoldA<T> {
private Car cr;
public static void main(String[] str){
HoldA<Car> c1=new HoldA<Car>(new Car<Double>());
Tag ht1=HTML.getTag(null);
}
private HoldA(T car) {
cr=(Car) car;
cr.name="fluffy";
cr.type=45.43;
System.out.println(cr);
System.out.println(cr.toStringCar());
cr.printing();
}
}
Комментарии (0) RSS
Добавить комментарий