Hi,
I am going to ask a question which is small bit silly but for me not as i want to grasp this information in mind.
The question is i have seen samples of different codes which have as following
Class A
{
int [] arr=new int[5];
public A()
{
arr={1,8,96,6,3} ;
}
public static meth()
{
//code
}
I dont understand few things in it e.g.
1. Why needed to constructor
2. Why we define array in class and initialize in Constructor?
Class B
{
int [] arr=new int[5];
public B(int i,int j)
{
int lo=i;
int hi=j;
}
public static meth()
{
//code
}
In Class B:
3. Why we pass paramreters and assign to local variables what we think when we do that?
Can you please answer my questions in nice way instead of being angry on my silly questions.I want to undertand this concept fully when to do or not to do like this?
Thanks,
Regds,