作者stellvia7 (stellvia)
看板java
标题[问题] class global 参数宣告处使用new class的问题
时间Tue Jan 4 15:40:51 2011
我不知道怎麽说比较清楚 程式码如下
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
1F:→ calais007:回答(3):是同一个 01/04 19:11
2F:→ calais007:回答(2)不可以,但你宣告成static就可以 01/04 19:13
3F:→ calais007:(1):看不懂你要问啥关系,如果是OO的观念就是都没关系 01/04 19:17