Probably this would be the very most basic question in Java. I want to tell you that i am basically from c background. Please bear with me.
I have a class and would like to have mHTable of type Hasbtable.
Question:
Where do i allocate memory for mHTable ? In the class definition or constructor?. Both seems to be working.
Case 1:
public class SampleClass
{
Hashtable<Integer, Integer> mHTble = new Hashtable<Integer, Integer>();
}
Or
public class SampleClass
{
public SampleClass()
{
mHTble = new Hashtable<Integer, Integer>();
}
}
I am trying this in Android.