how to create a generic constructor for a generic class in java?

You need to remove <T, E> from the constructor's signature: it's already there implicitly.

public KeyValue(T k , E v) // No compile errors here :)
{
    setKey(k);
    setValue(v);
}

Write constructor exactly the same way you wrote other methods

public KeyValue(T k , E v) 
    {
        setKey(k);
        setValue(v);
    }

the constructor can be written as

public<T,E> KeyValue(T k,E v){}

but its not necessary also we can writepublic KeyValue(T k,E v)