You get that error usually when you havent declared the variable.
Look at the line of code.
dog[x]=new dog();
You have declared the array as d[] not dog[] change it to d[x] and it should work.
Take some time off to read the error description.
Java error messages tend to be pretty exhaustive and clear (mostly).