当前位置: 技术问答>java相关
一个指针指向两个对象?
来源: 互联网 发布时间:2015-06-02
本文导语: TryInitialaization example = new TryInitialaization(); System.out.println("nFirst object:"); example.listValues(); example = new TryInitialaization(); System.out.println("nsecond object:"); example.listValues(); example怎么指向了两个对象呢?请指教。 完整代...
TryInitialaization example = new TryInitialaization();
System.out.println("nFirst object:");
example.listValues();
example = new TryInitialaization();
System.out.println("nsecond object:");
example.listValues();
example怎么指向了两个对象呢?请指教。
完整代码如下:
class TryInitialaization
{
static int[] values = new int[10];
static
{
System.out.print("Running initialization block");
for(int i=0; i
System.out.println("nFirst object:");
example.listValues();
example = new TryInitialaization();
System.out.println("nsecond object:");
example.listValues();
example怎么指向了两个对象呢?请指教。
完整代码如下:
class TryInitialaization
{
static int[] values = new int[10];
static
{
System.out.print("Running initialization block");
for(int i=0; i