October 25th, 2012, 06:39 PM
I think this should be very simple for someone skilled in java to fix, i've programed other languages pretty much so i understand somethings.
I have a constructor A(int age, string name) with
this.age=age , this.name=name
Now i have a second constructor A()
which should call the other one, but this one should make random
So i'm using this((int)(Math.random()*100,"name")
The problem is to make random names i can't put it like
this(...,names[Math....]) because it tells me i can't call the array before the super conductor, is there any way to give a string to a variable from the array before making the call to the first conductor?
Help is appreciated!
October 25th, 2012, 07:40 PM
Fixed the problem by adding a string changer for the name in the code that changes the name after the constructor has called the super constructor