public class test001
{
public int x,y;
test001()
{
}
}
public class test002
{
test002()
{
test001 xx=new test001();
xx.x=1;
}
}
public class test003
{
test003()
{
test001 xx;
xx.x=1;
}
}
test002和test003都調用test001的x變量
但是寫法不一樣,可否告知有何區別
...全文
3814打赏收藏
請問這兩种調用方式有啥區別
public class test001 { public int x,y; test001() { } } public class test002 { test002() { test001 xx=new test001(); xx.x=1; } } public class test003 { test003() { test001 xx; xx.x=1; } } test002和test003都調用test001的x變量 但是寫法不一樣,可否告知有何區別