If I have the following class:
public class Hello {
private String name;
public Hello(String n) {
this.name = n;
}
public int getSize(int x) {
return x + (this.name.length());
}
}
Now if I wish to create an array of 5 Hello objects, I could say
Hello[] t = new Hello[5];
My question is:
i) How do I call the constructor on each of elements of the array t
ii) After I have called the constructor, how can I call the method and pass the argument x to each element of the array?