Given the following code , from some reason it won't create an instance of MyVector . What might be the problem ? The problem occurs in the line of Main :

```
MyVector vec = new MyVector();

```

However , when I create the an instance of MyVector with the other constructor :

```
MyVector vec2 = new MyVector(arr);

```

it compile and the instance is allocated.

class Dot:

```
public class Dot {

    private double dotValue;

    public Dot(double dotValue)
    {
        this.dotValue = dotValue;
    }

    public double getDotValue()
    {
        return this.dotValue;
    }

    public void setDotValue(double newDotValue)
    {
        this.dotValue = newDotValue;
    }

    public String toString()
    {
        return "The Dot's value is :" + this.dotValue;
    }

}

```

class MyVector 

```
public class MyVector {

    private Dot[] arrayDots;

    MyVector()
    {       
        int k = 2;
        this.arrayDots = new Dot[k];
    }

    public MyVector(int k)
    {
        this.arrayDots = new Dot[k];
        int i = 0;
        while (i < k)
            arrayDots[i].setDotValue(0);
    }

    public MyVector(double array[])
    {
        this.arrayDots = new Dot[array.length];
        int i = 0;
        while (i < array.length)
        {
            this.arrayDots[i] = new Dot(array[i]);
            i++;
        }
    }

}

```

and Main

```
public class Main {

    public static void main(String[] args) {

        int k = 10;
        double [] arr = {0,1,2,3,4,5};
        System.out.println("Enter you K");
        MyVector vec = new MyVector();  // that line compile ,but when debugging it crashes , why ? 
        MyVector vec2 = new MyVector(arr);

    }
}

```

Regards
Ron