A: are used before sound consonant words.
Ex: a house; a cat; a dog; a european, a university.
An: are used before sound vowel words.
Ex: an hour; an apple, an orange.
We say, an hour because in the word hour the h is silent.
We say a university, a european because at the begining the u and the eu sound as Y.