我想界定 Java中一种任意类型的原始数据类型。 是否可能从一种任意的类型到另一种任意的类型来界定一种投放物?
public class Foo{
//methods, constructor etc for this class
...
//make it possible to cast an object of type Foo to an integer
}
//example of how an object of type foo would be cast to an integer
public class Bar(){
public static void main(String[] args){
Foo foo1 = new Foo();
int int1 = (int)foo1;
System.out.println(int1+"");
}
}