creating an object outside method
From: coltrane (tendengarci_at_yahoo.com)
Date: 03/30/05
- Next message: unni: "How to convert file formats?"
- Previous message: Marcin Grunwald: "Re: How do I finding the current static type?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 30 Mar 2005 05:25:06 -0800
There are 2 different places a class member can be instantiated, at the
class level of within a method :
>>
class MyClass {
AClass ac = new AClass(); // instantiated at class level
YetAnotherClass yac;
void someMethod(){
yac = new YetAnotherClass(); // instantiated with a method
}
}
>>
Are there an reasons I would choose one over the other?
Also, what if the class object was static?
thanks for your help
john
- Next message: unni: "How to convert file formats?"
- Previous message: Marcin Grunwald: "Re: How do I finding the current static type?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|