That method should be final, because if someone extends your class, you will probably wind up with unexpected (and quite probably, for your class, catastrophic) effects if the method called from the constructor is overridden, as the overridden method would be called, rather than the original.
an example lets say i have created a class Me.java which has the following constructors
public Me(String s)
public Me(int dead)
public static void main(String args)
Me theBasicConstructor = new Me();
Me theStringConstructor = new Me("Hello");
Me theIntegerConstructor = new Me(23);
i hope that this will give you the idea
The question was - can you call an instance method from a constructor? Your example calls constructors from the main method which is different. This is a simple example of what codered152 was asking for:
public class Me
private String name;
public Me(String aName)
public void setName(String aName)
name = aName;
I have a 2d matrix with dimension (3, n) called A, I want to calculate the normalization and cross product of two arrays (b,z) (see the code please) for each column (for the first column, then the second one and so on).
the function that I created to find the ...
Hi. I have a form with list box : lst_product, datagridview : grd_order and button: btn_addline. lst_product has a list of product ids selected from database (MS Acess 2013) , grd_order is by default empty except for 2 headers and btn_addline adds rows to grd_order.