【发布时间】:2011-04-19 20:22:07
【问题描述】:
我有以下课程:
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();
}
我的方法 create() 的重点是“返回”两个 Matriz 对象。我怎么能这样做?
【问题讨论】:
标签: java methods object scope instantiation