[問題] class global 參數宣告處使用new class的問題
我不知道怎麼說比較清楚 程式碼如下
class test02
{
test02()
{
System.out.print("test02\n");
}
}
public class test01
{
test01()
{
System.out.print("test01\n");
}
test02 t02 = new test02();
public static void main(String[] argv) {
test01 t01 = new test01();
}
}
我在class test01 中 ,寫了這一行test02 t02 = new test02();
(1)那麼test01 class 跟 test02 class 的關係是啥?
(2)在main中應該是不能使用 t02物件的對吧
(3)再來t01 跟 t02 應該是屬於不同process吧!
感恩 謝謝!!
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 220.130.36.2
→
01/04 19:11, , 1F
01/04 19:11, 1F
→
01/04 19:13, , 2F
01/04 19:13, 2F
→
01/04 19:17, , 3F
01/04 19:17, 3F