我有下面的类:实例化中使用的方法中的两个对象为“返回值”
public class Matriz
{
...
static public void create(Matriz a, Matriz b)
{
...
a=new Matriz(someValue,anotherValue);
b=new Matriz(someValue,anotherValue);
...
}
}
在我的主要方法:
public static void main(String[] args)
{
Matriz a=null,b=null;
Matriz.create(a,b);
//these are null
a.print();
b.print();
}
我的方法的创建点()是“返回”两个Matriz对象。我怎么能这样做?
+1用于一次创建一个。我们甚至可以使用Matriz类的构造函数来实现这个!喘气! – 2010-10-01 18:17:38